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

Side by Side Diff: sky/engine/core/rendering/RenderLayer.cpp

Issue 867463005: Merge the background paint phase into the foreground phase. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | « sky/engine/core/rendering/RenderLayer.h ('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) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 // If this layer's renderer is a child of the paintingRoot, we render uncond itionally, which 1036 // If this layer's renderer is a child of the paintingRoot, we render uncond itionally, which
1037 // is done by passing a nil paintingRoot down to our renderer (as if no pain tingRoot was ever set). 1037 // is done by passing a nil paintingRoot down to our renderer (as if no pain tingRoot was ever set).
1038 // Else, our renderer tree may or may not contain the painting root, so we p ass that root along 1038 // Else, our renderer tree may or may not contain the painting root, so we p ass that root along
1039 // so it will be tested against as we descend through the renderers. 1039 // so it will be tested against as we descend through the renderers.
1040 RenderObject* paintingRootForRenderer = 0; 1040 RenderObject* paintingRootForRenderer = 0;
1041 if (localPaintingInfo.paintingRoot && !renderer()->isDescendantOf(localPaint ingInfo.paintingRoot)) 1041 if (localPaintingInfo.paintingRoot && !renderer()->isDescendantOf(localPaint ingInfo.paintingRoot))
1042 paintingRootForRenderer = localPaintingInfo.paintingRoot; 1042 paintingRootForRenderer = localPaintingInfo.paintingRoot;
1043 1043
1044 LayoutPoint layerLocation = toPoint(layerBounds.location() - renderBoxLocati on() + localPaintingInfo.subPixelAccumulation); 1044 LayoutPoint layerLocation = toPoint(layerBounds.location() - renderBoxLocati on() + localPaintingInfo.subPixelAccumulation);
1045 1045
1046 if (shouldPaintContent) {
1047 paintBackground(context, transparencyLayerContext, paintingInfo.paintDir tyRect, haveTransparency,
1048 localPaintingInfo, paintingRootForRenderer, layerLocation, backgroun dRect);
1049 }
1050
1051 paintChildren(NegativeZOrderChildren, context, paintingInfo, paintFlags); 1046 paintChildren(NegativeZOrderChildren, context, paintingInfo, paintFlags);
1052 1047
1053 if (shouldPaintContent) { 1048 if (shouldPaintContent) {
1054 paintForeground(context, transparencyLayerContext, paintingInfo.paintDir tyRect, haveTransparency, 1049 paintForeground(context, transparencyLayerContext, paintingInfo.paintDir tyRect, haveTransparency,
1055 localPaintingInfo, paintingRootForRenderer, layerLocation, foregroun dRect); 1050 localPaintingInfo, paintingRootForRenderer, layerLocation, foregroun dRect);
1056 } 1051 }
1057 1052
1058 paintOutline(context, localPaintingInfo, paintingRootForRenderer, layerLocat ion, outlineRect); 1053 paintOutline(context, localPaintingInfo, paintingRootForRenderer, layerLocat ion, outlineRect);
1059 paintChildren(NormalFlowChildren | PositiveZOrderChildren, context, painting Info, paintFlags); 1054 paintChildren(NormalFlowChildren | PositiveZOrderChildren, context, painting Info, paintFlags);
1060 1055
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 #if ENABLE(ASSERT) 1108 #if ENABLE(ASSERT)
1114 LayerListMutationDetector mutationChecker(m_stackingNode.get()); 1109 LayerListMutationDetector mutationChecker(m_stackingNode.get());
1115 #endif 1110 #endif
1116 1111
1117 RenderLayerStackingNodeIterator iterator(*m_stackingNode, childrenToVisit); 1112 RenderLayerStackingNodeIterator iterator(*m_stackingNode, childrenToVisit);
1118 while (RenderLayerStackingNode* child = iterator.next()) { 1113 while (RenderLayerStackingNode* child = iterator.next()) {
1119 child->layer()->paintLayer(context, paintingInfo, paintFlags); 1114 child->layer()->paintLayer(context, paintingInfo, paintFlags);
1120 } 1115 }
1121 } 1116 }
1122 1117
1123 void RenderLayer::paintBackground(GraphicsContext* context, GraphicsContext* tra nsparencyLayerContext,
1124 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo,
1125 RenderObject* paintingRootForRenderer, LayoutPoint& layerLocation, ClipRect& layerBackgroundRect)
1126 {
1127 // Begin transparency layers lazily now that we know we have to paint someth ing.
1128 if (haveTransparency)
1129 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.root Layer, transparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation);
1130
1131 if (localPaintingInfo.clipToDirtyRect) {
1132 // Paint our background first, before painting any child layers.
1133 // Establish the clip used to paint our background.
1134 clipToRect(localPaintingInfo, context, layerBackgroundRect, DoNotInclude SelfForBorderRadius); // Background painting will handle clipping to self.
1135 }
1136
1137 // Paint the background.
1138 // FIXME: Eventually we will collect the region from the fragment itself ins tead of just from the paint info.
1139 PaintInfo paintInfo(context, pixelSnappedIntRect(layerBackgroundRect.rect()) , PaintPhaseBlockBackground, paintingRootForRenderer, 0, localPaintingInfo.rootL ayer->renderer());
1140 renderer()->paint(paintInfo, layerLocation);
1141
1142 if (localPaintingInfo.clipToDirtyRect)
1143 restoreClip(context, localPaintingInfo.paintDirtyRect, layerBackgroundRe ct);
1144 }
1145
1146 void RenderLayer::paintForeground(GraphicsContext* context, GraphicsContext* tra nsparencyLayerContext, 1118 void RenderLayer::paintForeground(GraphicsContext* context, GraphicsContext* tra nsparencyLayerContext,
1147 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, 1119 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo,
1148 RenderObject* paintingRootForRenderer, LayoutPoint& layerLocation, ClipRect& layerForegroundRect) 1120 RenderObject* paintingRootForRenderer, LayoutPoint& layerLocation, ClipRect& layerForegroundRect)
1149 { 1121 {
1150 bool foregroundRectIsEmpty = layerForegroundRect.isEmpty(); 1122 bool foregroundRectIsEmpty = layerForegroundRect.isEmpty();
1151 1123
1152 // Begin transparency if we have something to paint. 1124 // Begin transparency if we have something to paint.
1153 if (haveTransparency && !foregroundRectIsEmpty) 1125 if (haveTransparency && !foregroundRectIsEmpty)
1154 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.root Layer, transparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation); 1126 beginTransparencyLayers(transparencyLayerContext, localPaintingInfo.root Layer, transparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation);
1155 1127
1156 // Optimize clipping for the single fragment case. 1128 // Optimize clipping for the single fragment case.
1157 bool shouldClip = localPaintingInfo.clipToDirtyRect && !foregroundRectIsEmpt y; 1129 bool shouldClip = localPaintingInfo.clipToDirtyRect && !foregroundRectIsEmpt y;
1158 if (shouldClip) 1130 if (shouldClip)
1159 clipToRect(localPaintingInfo, context, layerForegroundRect); 1131 clipToRect(localPaintingInfo, context, layerForegroundRect);
1160 1132
1161 if (!foregroundRectIsEmpty) { 1133 if (!foregroundRectIsEmpty) {
1162 // We have to loop through every fragment multiple times, since we have to issue paint invalidations in each specific phase in order for 1134 // We have to loop through every fragment multiple times, since we have to issue paint invalidations in each specific phase in order for
1163 // interleaving of the fragments to work properly. 1135 // interleaving of the fragments to work properly.
1164 // FIXME(sky): Do we still need this for anything now that we don't have fragments? 1136 // FIXME(sky): Do we still need this for anything now that we don't have fragments?
1165 paintForegroundWithPhase(PaintPhaseChildBlockBackgrounds,
1166 context, localPaintingInfo, paintingRootForRenderer,
1167 layerLocation, layerForegroundRect);
1168 paintForegroundWithPhase(PaintPhaseForeground, 1137 paintForegroundWithPhase(PaintPhaseForeground,
1169 context, localPaintingInfo, paintingRootForRenderer, 1138 context, localPaintingInfo, paintingRootForRenderer,
1170 layerLocation, layerForegroundRect); 1139 layerLocation, layerForegroundRect);
1171 paintForegroundWithPhase(PaintPhaseChildOutlines, 1140 paintForegroundWithPhase(PaintPhaseChildOutlines,
1172 context, localPaintingInfo, paintingRootForRenderer, 1141 context, localPaintingInfo, paintingRootForRenderer,
1173 layerLocation, layerForegroundRect); 1142 layerLocation, layerForegroundRect);
1174 } 1143 }
1175 1144
1176 if (shouldClip) 1145 if (shouldClip)
1177 restoreClip(context, localPaintingInfo.paintDirtyRect, layerForegroundRe ct); 1146 restoreClip(context, localPaintingInfo.paintDirtyRect, layerForegroundRe ct);
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 } 1858 }
1890 } 1859 }
1891 1860
1892 void showLayerTree(const blink::RenderObject* renderer) 1861 void showLayerTree(const blink::RenderObject* renderer)
1893 { 1862 {
1894 if (!renderer) 1863 if (!renderer)
1895 return; 1864 return;
1896 showLayerTree(renderer->enclosingLayer()); 1865 showLayerTree(renderer->enclosingLayer());
1897 } 1866 }
1898 #endif 1867 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderLayer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698