| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 m_headsUpDisplay = CCHeadsUpDisplay::create(this); | 181 m_headsUpDisplay = CCHeadsUpDisplay::create(this); |
| 182 } | 182 } |
| 183 | 183 |
| 184 LayerRendererChromium::~LayerRendererChromium() | 184 LayerRendererChromium::~LayerRendererChromium() |
| 185 { | 185 { |
| 186 m_headsUpDisplay.clear(); // Explicitly destroy the HUD before the TextureMa
nager dies. | 186 m_headsUpDisplay.clear(); // Explicitly destroy the HUD before the TextureMa
nager dies. |
| 187 cleanupSharedObjects(); | 187 cleanupSharedObjects(); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void LayerRendererChromium::clearRenderSurfacesOnCCLayerImplRecursive(CCLayerImp
l* layer) |
| 191 { |
| 192 for (size_t i = 0; i < layer->children().size(); ++i) |
| 193 clearRenderSurfacesOnCCLayerImplRecursive(layer->children()[i].get()); |
| 194 layer->clearRenderSurface(); |
| 195 } |
| 196 |
| 197 void LayerRendererChromium::clearRootCCLayerImpl() |
| 198 { |
| 199 if (m_rootCCLayerImpl) |
| 200 clearRenderSurfacesOnCCLayerImplRecursive(m_rootCCLayerImpl.get()); |
| 201 m_computedRenderSurfaceLayerList.clear(); |
| 202 m_rootCCLayerImpl.clear(); |
| 203 } |
| 204 |
| 190 GraphicsContext3D* LayerRendererChromium::context() | 205 GraphicsContext3D* LayerRendererChromium::context() |
| 191 { | 206 { |
| 192 return m_context.get(); | 207 return m_context.get(); |
| 193 } | 208 } |
| 194 | 209 |
| 195 #if USE(SKIA) | 210 #if USE(SKIA) |
| 196 GrContext* LayerRendererChromium::skiaContext() | 211 GrContext* LayerRendererChromium::skiaContext() |
| 197 { | 212 { |
| 198 if (!m_skiaContext && m_contextSupportsTextureFormatBGRA && m_contextSupport
sReadFormatBGRA) { | 213 if (!m_skiaContext && m_contextSupportsTextureFormatBGRA && m_contextSupport
sReadFormatBGRA) { |
| 199 m_context->makeContextCurrent(); | 214 m_context->makeContextCurrent(); |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 m_context->prepareTexture(); | 610 m_context->prepareTexture(); |
| 596 | 611 |
| 597 m_headsUpDisplay->onPresent(); | 612 m_headsUpDisplay->onPresent(); |
| 598 } | 613 } |
| 599 | 614 |
| 600 void LayerRendererChromium::setRootLayer(PassRefPtr<LayerChromium> layer) | 615 void LayerRendererChromium::setRootLayer(PassRefPtr<LayerChromium> layer) |
| 601 { | 616 { |
| 602 m_rootLayer = layer; | 617 m_rootLayer = layer; |
| 603 if (m_rootLayer) | 618 if (m_rootLayer) |
| 604 m_rootLayer->setLayerRenderer(this); | 619 m_rootLayer->setLayerRenderer(this); |
| 620 else |
| 621 clearRootCCLayerImpl(); |
| 605 m_rootLayerContentTiler->invalidateEntireLayer(); | 622 m_rootLayerContentTiler->invalidateEntireLayer(); |
| 606 } | 623 } |
| 607 | 624 |
| 608 void LayerRendererChromium::setLayerRendererRecursive(LayerChromium* layer) | 625 void LayerRendererChromium::setLayerRendererRecursive(LayerChromium* layer) |
| 609 { | 626 { |
| 610 const Vector<RefPtr<LayerChromium> >& children = layer->children(); | 627 const Vector<RefPtr<LayerChromium> >& children = layer->children(); |
| 611 for (size_t i = 0; i < children.size(); ++i) | 628 for (size_t i = 0; i < children.size(); ++i) |
| 612 setLayerRendererRecursive(children[i].get()); | 629 setLayerRendererRecursive(children[i].get()); |
| 613 | 630 |
| 614 if (layer->maskLayer()) | 631 if (layer->maskLayer()) |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1306 return m_videoLayerYUVProgram.get(); | 1323 return m_videoLayerYUVProgram.get(); |
| 1307 } | 1324 } |
| 1308 | 1325 |
| 1309 | 1326 |
| 1310 void LayerRendererChromium::cleanupSharedObjects() | 1327 void LayerRendererChromium::cleanupSharedObjects() |
| 1311 { | 1328 { |
| 1312 makeContextCurrent(); | 1329 makeContextCurrent(); |
| 1313 | 1330 |
| 1314 m_sharedGeometry.clear(); | 1331 m_sharedGeometry.clear(); |
| 1315 m_borderProgram.clear(); | 1332 m_borderProgram.clear(); |
| 1316 m_canvasLayerProgram.clear(); | |
| 1317 m_headsUpDisplayProgram.clear(); | 1333 m_headsUpDisplayProgram.clear(); |
| 1318 m_videoLayerRGBAProgram.clear(); | |
| 1319 m_videoLayerYUVProgram.clear(); | |
| 1320 m_pluginLayerProgram.clear(); | |
| 1321 m_renderSurfaceProgram.clear(); | 1334 m_renderSurfaceProgram.clear(); |
| 1322 m_renderSurfaceMaskProgram.clear(); | 1335 m_renderSurfaceMaskProgram.clear(); |
| 1323 m_tilerProgram.clear(); | 1336 m_tilerProgram.clear(); |
| 1324 m_tilerProgramSwizzle.clear(); | 1337 m_tilerProgramSwizzle.clear(); |
| 1338 m_tilerProgramAA.clear(); |
| 1339 m_tilerProgramSwizzleAA.clear(); |
| 1340 m_canvasLayerProgram.clear(); |
| 1341 m_videoLayerRGBAProgram.clear(); |
| 1342 m_videoLayerYUVProgram.clear(); |
| 1343 m_pluginLayerProgram.clear(); |
| 1325 if (m_offscreenFramebufferId) | 1344 if (m_offscreenFramebufferId) |
| 1326 GLC(m_context.get(), m_context->deleteFramebuffer(m_offscreenFramebuffer
Id)); | 1345 GLC(m_context.get(), m_context->deleteFramebuffer(m_offscreenFramebuffer
Id)); |
| 1327 | 1346 |
| 1328 // Clear tilers before the texture manager, as they have references to textu
res. | 1347 // Clear tilers before the texture manager, as they have references to textu
res. |
| 1329 m_rootLayerContentTiler.clear(); | 1348 m_rootLayerContentTiler.clear(); |
| 1330 | 1349 |
| 1331 m_contentsTextureManager.clear(); | 1350 m_contentsTextureManager.clear(); |
| 1332 m_renderSurfaceTextureManager.clear(); | 1351 m_renderSurfaceTextureManager.clear(); |
| 1333 } | 1352 } |
| 1334 | 1353 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 PassOwnPtr<CCLayerTreeHostImplProxy> LayerRendererChromium::createLayerTreeHostI
mplProxy() | 1476 PassOwnPtr<CCLayerTreeHostImplProxy> LayerRendererChromium::createLayerTreeHostI
mplProxy() |
| 1458 { | 1477 { |
| 1459 OwnPtr<CCLayerTreeHostImplProxy> proxy = LayerRendererChromiumImplProxy::cre
ate(this); | 1478 OwnPtr<CCLayerTreeHostImplProxy> proxy = LayerRendererChromiumImplProxy::cre
ate(this); |
| 1460 proxy->start(); | 1479 proxy->start(); |
| 1461 return proxy.release(); | 1480 return proxy.release(); |
| 1462 } | 1481 } |
| 1463 | 1482 |
| 1464 } // namespace WebCore | 1483 } // namespace WebCore |
| 1465 | 1484 |
| 1466 #endif // USE(ACCELERATED_COMPOSITING) | 1485 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |