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

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 1441973003: Use recomputed interest rect only if it changed enough (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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) 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 2238 matching lines...) Expand 10 before | Expand all | Expand 10 after
2249 if (newInterestRect.y() == 0 && previousInterestRect.y() != 0) 2249 if (newInterestRect.y() == 0 && previousInterestRect.y() != 0)
2250 return true; 2250 return true;
2251 if (newInterestRect.maxX() == layerSize.width() && previousInterestRect.maxX () != layerSize.width()) 2251 if (newInterestRect.maxX() == layerSize.width() && previousInterestRect.maxX () != layerSize.width())
2252 return true; 2252 return true;
2253 if (newInterestRect.maxY() == layerSize.height() && previousInterestRect.max Y() != layerSize.height()) 2253 if (newInterestRect.maxY() == layerSize.height() && previousInterestRect.max Y() != layerSize.height())
2254 return true; 2254 return true;
2255 2255
2256 return false; 2256 return false;
2257 } 2257 }
2258 2258
2259 void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, G raphicsContext& context, GraphicsLayerPaintingPhase graphicsLayerPaintingPhase, const IntRect* interestRect) const 2259 IntRect CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer , GraphicsContext& context, GraphicsLayerPaintingPhase graphicsLayerPaintingPhas e, const IntRect* interestRect) const
2260 { 2260 {
2261 IntRect defaultInterestRect; 2261 IntRect defaultInterestRect;
2262 IntRect previousInterestRect = graphicsLayer->previousInterestRect();
chrishtr 2015/11/16 23:29:40 If there were a method computeInterestRect and int
Xianzhu 2015/11/17 00:42:11 Done.
2262 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) { 2263 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) {
2263 if (!interestRect) { 2264 if (!interestRect) {
2264 if (graphicsLayer == m_graphicsLayer || graphicsLayer == m_squashing Layer) 2265 if (graphicsLayer == m_graphicsLayer || graphicsLayer == m_squashing Layer)
2265 defaultInterestRect = computeInterestRect(graphicsLayer, m_ownin gLayer.layoutObject()); 2266 defaultInterestRect = computeInterestRect(graphicsLayer, m_ownin gLayer.layoutObject());
2266 else 2267 else
2267 defaultInterestRect = enclosingIntRect(FloatRect(FloatPoint(), g raphicsLayer->size())); 2268 defaultInterestRect = enclosingIntRect(FloatRect(FloatPoint(), g raphicsLayer->size()));
2268 interestRect = &defaultInterestRect; 2269
2270 if (interestRectChangedEnoughToRepaint(previousInterestRect, default InterestRect, expandedIntSize(graphicsLayer->size())))
2271 interestRect = &defaultInterestRect;
2272 else
2273 interestRect = &previousInterestRect;
2269 } 2274 }
2270 2275
2271 if (!m_owningLayer.needsRepaint() 2276 if (!m_owningLayer.needsRepaint()
2272 && !context.paintController().cacheIsEmpty() 2277 && !context.paintController().cacheIsEmpty()
2273 && !interestRectChangedEnoughToRepaint(m_previousPaintInterestRect, *interestRect, expandedIntSize(graphicsLayer->size()))) { 2278 && previousInterestRect == *interestRect) {
2274 context.paintController().createAndAppend<CachedDisplayItem>(*this, DisplayItem::CachedDisplayItemList); 2279 context.paintController().createAndAppend<CachedDisplayItem>(*this, DisplayItem::CachedDisplayItemList);
2275 return; 2280 return previousInterestRect;
2276 } 2281 }
2277
2278 m_previousPaintInterestRect = *interestRect;
2279 } 2282 }
2280 2283
2281 ASSERT(interestRect); 2284 ASSERT(interestRect);
2282 paintContentsInternal(graphicsLayer, context, graphicsLayerPaintingPhase, *i nterestRect); 2285 paintContentsInternal(graphicsLayer, context, graphicsLayerPaintingPhase, *i nterestRect);
2286
2287 return *interestRect;
2283 } 2288 }
2284 2289
2285 void CompositedLayerMapping::paintContentsInternal(const GraphicsLayer* graphics Layer, GraphicsContext& context, GraphicsLayerPaintingPhase graphicsLayerPaintin gPhase, const IntRect& interestRect) const 2290 void CompositedLayerMapping::paintContentsInternal(const GraphicsLayer* graphics Layer, GraphicsContext& context, GraphicsLayerPaintingPhase graphicsLayerPaintin gPhase, const IntRect& interestRect) const
2286 { 2291 {
2287 // https://code.google.com/p/chromium/issues/detail?id=343772 2292 // https://code.google.com/p/chromium/issues/detail?id=343772
2288 DisableCompositingQueryAsserts disabler; 2293 DisableCompositingQueryAsserts disabler;
2289 #if ENABLE(ASSERT) 2294 #if ENABLE(ASSERT)
2290 // FIXME: once the state machine is ready, this can be removed and we can re fer to that instead. 2295 // FIXME: once the state machine is ready, this can be removed and we can re fer to that instead.
2291 if (Page* page = layoutObject()->frame()->page()) 2296 if (Page* page = layoutObject()->frame()->page())
2292 page->setIsPainting(true); 2297 page->setIsPainting(true);
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
2521 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { 2526 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
2522 name = "Scrolling Block Selection Layer"; 2527 name = "Scrolling Block Selection Layer";
2523 } else { 2528 } else {
2524 ASSERT_NOT_REACHED(); 2529 ASSERT_NOT_REACHED();
2525 } 2530 }
2526 2531
2527 return name; 2532 return name;
2528 } 2533 }
2529 2534
2530 } // namespace blink 2535 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698