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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp

Issue 2238883006: SPv2: Use GeometryMapper to implement PaintLayerClipper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: none Created 4 years, 4 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 // 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 "core/paint/PaintLayerPainter.h" 5 #include "core/paint/PaintLayerPainter.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/frame/Settings.h" 8 #include "core/frame/Settings.h"
9 #include "core/layout/LayoutBlock.h" 9 #include "core/layout/LayoutBlock.h"
10 #include "core/layout/LayoutView.h" 10 #include "core/layout/LayoutView.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 228
229 static bool shouldRepaintSubsequence(PaintLayer& paintLayer, const PaintLayerPai ntingInfo& paintingInfo, ShouldRespectOverflowClipType respectOverflowClip, cons t LayoutSize& subpixelAccumulation) 229 static bool shouldRepaintSubsequence(PaintLayer& paintLayer, const PaintLayerPai ntingInfo& paintingInfo, ShouldRespectOverflowClipType respectOverflowClip, cons t LayoutSize& subpixelAccumulation)
230 { 230 {
231 bool needsRepaint = false; 231 bool needsRepaint = false;
232 232
233 // Repaint subsequence if the layer is marked for needing repaint. 233 // Repaint subsequence if the layer is marked for needing repaint.
234 if (paintLayer.needsRepaint()) 234 if (paintLayer.needsRepaint())
235 needsRepaint = true; 235 needsRepaint = true;
236 236
237 // Repaint if layer's clip changes. 237 // Repaint if layer's clip changes.
238 ClipRects& clipRects = paintLayer.clipper().paintingClipRects(paintingInfo.r ootLayer, respectOverflowClip, subpixelAccumulation); 238 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
239 ClipRects* previousClipRects = paintLayer.previousPaintingClipRects(); 239 ClipRects& clipRects = paintLayer.clipper().paintingClipRects(paintingIn fo.rootLayer, respectOverflowClip, subpixelAccumulation);
240 if (!needsRepaint && &clipRects != previousClipRects && (!previousClipRects || clipRects != *previousClipRects)) 240 ClipRects* previousClipRects = paintLayer.previousPaintingClipRects();
241 needsRepaint = true; 241 if (!needsRepaint && &clipRects != previousClipRects && (!previousClipRe cts || clipRects != *previousClipRects))
242 paintLayer.setPreviousPaintingClipRects(clipRects); 242 needsRepaint = true;
243 paintLayer.setPreviousPaintingClipRects(clipRects);
244 }
243 245
244 // Repaint if previously the layer might be clipped by paintDirtyRect and pa intDirtyRect changes. 246 // Repaint if previously the layer might be clipped by paintDirtyRect and pa intDirtyRect changes.
245 if (!needsRepaint && paintLayer.previousPaintResult() == PaintLayerPainter:: MayBeClippedByPaintDirtyRect && paintLayer.previousPaintDirtyRect() != paintingI nfo.paintDirtyRect) 247 if (!needsRepaint && paintLayer.previousPaintResult() == PaintLayerPainter:: MayBeClippedByPaintDirtyRect && paintLayer.previousPaintDirtyRect() != paintingI nfo.paintDirtyRect)
246 needsRepaint = true; 248 needsRepaint = true;
247 paintLayer.setPreviousPaintDirtyRect(paintingInfo.paintDirtyRect); 249 paintLayer.setPreviousPaintDirtyRect(paintingInfo.paintDirtyRect);
248 250
249 // Repaint if scroll offset accumulation changes. 251 // Repaint if scroll offset accumulation changes.
250 if (!needsRepaint && paintingInfo.scrollOffsetAccumulation != paintLayer.pre viousScrollOffsetAccumulationForPainting()) 252 if (!needsRepaint && paintingInfo.scrollOffsetAccumulation != paintLayer.pre viousScrollOffsetAccumulationForPainting())
251 needsRepaint = true; 253 needsRepaint = true;
252 paintLayer.setPreviousScrollOffsetAccumulationForPainting(paintingInfo.scrol lOffsetAccumulation); 254 paintLayer.setPreviousScrollOffsetAccumulationForPainting(paintingInfo.scrol lOffsetAccumulation);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 if (shouldPaintContent || shouldPaintSelfOutline || isPaintingOverlayScrollb ars) { 340 if (shouldPaintContent || shouldPaintSelfOutline || isPaintingOverlayScrollb ars) {
339 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment. 341 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment.
340 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects ) ? UncachedClipRects : PaintingClipRects; 342 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects ) ? UncachedClipRects : PaintingClipRects;
341 // TODO(trchen): We haven't decided how to handle visual fragmentation w ith SPv2. 343 // TODO(trchen): We haven't decided how to handle visual fragmentation w ith SPv2.
342 // Related thread https://groups.google.com/a/chromium.org/forum/#!topic /graphics-dev/81XuWFf-mxM 344 // Related thread https://groups.google.com/a/chromium.org/forum/#!topic /graphics-dev/81XuWFf-mxM
343 if (fragmentPolicy == ForceSingleFragment || RuntimeEnabledFeatures::sli mmingPaintV2Enabled()) 345 if (fragmentPolicy == ForceSingleFragment || RuntimeEnabledFeatures::sli mmingPaintV2Enabled())
344 m_paintLayer.appendSingleFragmentIgnoringPagination(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, cacheSlot, Ignore OverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.su bPixelAccumulation); 346 m_paintLayer.appendSingleFragmentIgnoringPagination(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, cacheSlot, Ignore OverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.su bPixelAccumulation);
345 else 347 else
346 m_paintLayer.collectFragments(layerFragments, localPaintingInfo.root Layer, localPaintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation); 348 m_paintLayer.collectFragments(layerFragments, localPaintingInfo.root Layer, localPaintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation);
347 349
348 // TODO(trchen): Needs to adjust cull rect between transform spaces. htt ps://crbug.com/593596
349 // Disables layer culling for SPv2 for now because the space of the cull rect doesn't match
350 // the space we paint in. Clipping will still be done by clip nodes, so this won't cause
351 // rendering issues, only performance.
352 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
353 layerFragments[0].backgroundRect = LayoutRect(LayoutRect::infiniteIn tRect());
354 layerFragments[0].foregroundRect = LayoutRect(LayoutRect::infiniteIn tRect());
355 }
356
357 if (shouldPaintContent) { 350 if (shouldPaintContent) {
358 // TODO(wangxianzhu): This is for old slow scrolling. Implement simi lar optimization for slimming paint v2. 351 // TODO(wangxianzhu): This is for old slow scrolling. Implement simi lar optimization for slimming paint v2.
359 shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFra gments, localPaintingInfo, paintFlags, offsetFromRoot); 352 shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFra gments, localPaintingInfo, paintFlags, offsetFromRoot);
360 if (!shouldPaintContent) 353 if (!shouldPaintContent)
361 result = MayBeClippedByPaintDirtyRect; 354 result = MayBeClippedByPaintDirtyRect;
362 } 355 }
363 } 356 }
364 357
365 bool selectionOnly = localPaintingInfo.getGlobalPaintFlags() & GlobalPaintSe lectionOnly; 358 bool selectionOnly = localPaintingInfo.getGlobalPaintFlags() & GlobalPaintSe lectionOnly;
366 359
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 if (!m_paintLayer.containsDirtyOverlayScrollbars()) 809 if (!m_paintLayer.containsDirtyOverlayScrollbars())
817 return; 810 return;
818 811
819 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), paintFlags, LayoutSize()); 812 PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRe ct(damageRect)), paintFlags, LayoutSize());
820 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); 813 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars);
821 814
822 m_paintLayer.setContainsDirtyOverlayScrollbars(false); 815 m_paintLayer.setContainsDirtyOverlayScrollbars(false);
823 } 816 }
824 817
825 } // namespace blink 818 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698