Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 316 | 316 |
| 317 void HTMLCanvasElement::didFinalizeFrame() { | 317 void HTMLCanvasElement::didFinalizeFrame() { |
| 318 notifyListenersCanvasChanged(); | 318 notifyListenersCanvasChanged(); |
| 319 | 319 |
| 320 if (m_dirtyRect.isEmpty()) | 320 if (m_dirtyRect.isEmpty()) |
| 321 return; | 321 return; |
| 322 | 322 |
| 323 // Propagate the m_dirtyRect accumulated so far to the compositor | 323 // Propagate the m_dirtyRect accumulated so far to the compositor |
| 324 // before restarting with a blank dirty rect. | 324 // before restarting with a blank dirty rect. |
| 325 FloatRect srcRect(0, 0, size().width(), size().height()); | 325 FloatRect srcRect(0, 0, size().width(), size().height()); |
| 326 m_dirtyRect.intersect(srcRect); | 326 |
| 327 LayoutBox* ro = layoutBox(); | 327 LayoutBox* ro = layoutBox(); |
| 328 // Canvas content updates do not need to be propagated as | 328 // Canvas content updates do not need to be propagated as |
| 329 // paint invalidations if the canvas is accelerated, since | 329 // paint invalidations if the canvas is accelerated, since |
| 330 // the canvas contents are sent separately through a texture layer. | 330 // the canvas contents are sent separately through a texture layer. |
| 331 if (ro && (!m_context || !m_context->isAccelerated())) { | 331 if (ro && (!m_context || !m_context->isAccelerated())) { |
| 332 // If ro->contentBoxRect() is larger than srcRect the canvas's image is | |
| 333 // being stretched, so we need to account for color bleeding caused by the | |
| 334 // interpollation filter. | |
| 335 if (ro->contentBoxRect().width() > srcRect.width() || | |
| 336 ro->contentBoxRect().height() > srcRect.height()) { | |
| 337 m_dirtyRect.inflate(0.25); | |
|
Justin Novosad
2016/10/25 14:30:15
Are you sure 0.25 is always enough? Even at very l
| |
| 338 } | |
| 339 | |
| 340 m_dirtyRect.intersect(srcRect); | |
| 332 LayoutRect mappedDirtyRect(enclosingIntRect( | 341 LayoutRect mappedDirtyRect(enclosingIntRect( |
| 333 mapRect(m_dirtyRect, srcRect, FloatRect(ro->contentBoxRect())))); | 342 mapRect(m_dirtyRect, srcRect, FloatRect(ro->contentBoxRect())))); |
| 334 // For querying PaintLayer::compositingState() | 343 // For querying PaintLayer::compositingState() |
| 335 // FIXME: is this invalidation using the correct compositing state? | 344 // FIXME: is this invalidation using the correct compositing state? |
| 336 DisableCompositingQueryAsserts disabler; | 345 DisableCompositingQueryAsserts disabler; |
| 337 ro->invalidatePaintRectangle(mappedDirtyRect); | 346 ro->invalidatePaintRectangle(mappedDirtyRect); |
| 338 } | 347 } |
| 339 m_dirtyRect = FloatRect(); | 348 m_dirtyRect = FloatRect(); |
| 340 | 349 |
| 341 m_numFramesSinceLastRenderingModeSwitch++; | 350 m_numFramesSinceLastRenderingModeSwitch++; |
| (...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1345 mojom::blink::OffscreenCanvasSurfacePtr service; | 1354 mojom::blink::OffscreenCanvasSurfacePtr service; |
| 1346 Platform::current()->interfaceProvider()->getInterface( | 1355 Platform::current()->interfaceProvider()->getInterface( |
| 1347 mojo::GetProxy(&service)); | 1356 mojo::GetProxy(&service)); |
| 1348 m_surfaceLayerBridge = | 1357 m_surfaceLayerBridge = |
| 1349 wrapUnique(new CanvasSurfaceLayerBridge(std::move(service))); | 1358 wrapUnique(new CanvasSurfaceLayerBridge(std::move(service))); |
| 1350 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), | 1359 return m_surfaceLayerBridge->createSurfaceLayer(this->width(), |
| 1351 this->height()); | 1360 this->height()); |
| 1352 } | 1361 } |
| 1353 | 1362 |
| 1354 } // namespace blink | 1363 } // namespace blink |
| OLD | NEW |