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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GraphicsLayer.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: Fix release builds 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 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 if (offset == m_offsetFromLayoutObject) 286 if (offset == m_offsetFromLayoutObject)
287 return; 287 return;
288 288
289 m_offsetFromLayoutObject = offset; 289 m_offsetFromLayoutObject = offset;
290 290
291 // If the compositing layer offset changes, we need to repaint. 291 // If the compositing layer offset changes, we need to repaint.
292 if (shouldSetNeedsDisplay == SetNeedsDisplay) 292 if (shouldSetNeedsDisplay == SetNeedsDisplay)
293 setNeedsDisplay(); 293 setNeedsDisplay();
294 } 294 }
295 295
296 void GraphicsLayer::paint(GraphicsContext& context, const IntRect* clip) 296 void GraphicsLayer::paint(GraphicsContext& context, const IntRect* interestRect)
297 { 297 {
298 ASSERT(clip || RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnab led()); 298 ASSERT(interestRect || RuntimeEnabledFeatures::slimmingPaintSynchronizedPain tingEnabled());
299 ASSERT(drawsContent()); 299 ASSERT(drawsContent());
300 300
301 if (!m_client) 301 if (!m_client)
302 return; 302 return;
303 if (firstPaintInvalidationTrackingEnabled()) 303 if (firstPaintInvalidationTrackingEnabled())
304 m_debugInfo.clearAnnotatedInvalidateRects(); 304 m_debugInfo.clearAnnotatedInvalidateRects();
305 incrementPaintCount(); 305 incrementPaintCount();
306 #ifndef NDEBUG 306 #ifndef NDEBUG
307 if (m_paintController && contentsOpaque() && s_drawDebugRedFill) { 307 if (m_paintController && contentsOpaque() && s_drawDebugRedFill) {
308 FloatRect rect(FloatPoint(), size()); 308 FloatRect rect(FloatPoint(), size());
309 if (!DrawingRecorder::useCachedDrawingIfPossible(context, *this, Display Item::DebugRedFill)) { 309 if (!DrawingRecorder::useCachedDrawingIfPossible(context, *this, Display Item::DebugRedFill)) {
310 DrawingRecorder recorder(context, *this, DisplayItem::DebugRedFill, rect); 310 DrawingRecorder recorder(context, *this, DisplayItem::DebugRedFill, rect);
311 context.fillRect(rect, SK_ColorRED); 311 context.fillRect(rect, SK_ColorRED);
312 } 312 }
313 } 313 }
314 #endif 314 #endif
315 m_client->paintContents(this, context, m_paintingPhase, clip); 315
316 IntRect newInterestRect;
317 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) {
318 if (!interestRect) {
319 newInterestRect = m_client->computeInterestRect(this, m_previousInte restRect);
320 interestRect = &newInterestRect;
321 }
322 if (!m_client->needsRepaint() && !paintController()->cacheIsEmpty() && m _previousInterestRect == *interestRect) {
323 paintController()->createAndAppend<CachedDisplayItem>(*this, Display Item::CachedDisplayItemList);
324 return;
325 }
326 }
327
328 m_client->paintContents(this, context, m_paintingPhase, *interestRect);
316 notifyFirstPaintToClient(); 329 notifyFirstPaintToClient();
330 m_previousInterestRect = *interestRect;
317 } 331 }
318 332
319 void GraphicsLayer::notifyFirstPaintToClient() 333 void GraphicsLayer::notifyFirstPaintToClient()
320 { 334 {
321 if (!m_painted) { 335 if (!m_painted) {
322 m_painted = true; 336 m_painted = true;
323 m_client->notifyFirstPaint(); 337 m_client->notifyFirstPaint();
324 } 338 }
325 if (!m_textPainted && m_paintController->textPainted()) { 339 if (!m_textPainted && m_paintController->textPainted()) {
326 m_textPainted = true; 340 m_textPainted = true;
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 { 1206 {
1193 if (!layer) { 1207 if (!layer) {
1194 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n"); 1208 fprintf(stderr, "Cannot showGraphicsLayerTree for (nil).\n");
1195 return; 1209 return;
1196 } 1210 }
1197 1211
1198 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo); 1212 String output = layer->layerTreeAsText(blink::LayerTreeIncludesDebugInfo);
1199 fprintf(stderr, "%s\n", output.utf8().data()); 1213 fprintf(stderr, "%s\n", output.utf8().data());
1200 } 1214 }
1201 #endif 1215 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698