| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/graphics/CanvasSurfaceLayerBridge.h" | 5 #include "platform/graphics/CanvasSurfaceLayerBridge.h" |
| 6 | 6 |
| 7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
| 8 #include "cc/layers/solid_color_layer.h" | 8 #include "cc/layers/solid_color_layer.h" |
| 9 #include "cc/layers/surface_layer.h" | 9 #include "cc/layers/surface_layer.h" |
| 10 #include "cc/surfaces/sequence_surface_reference_factory.h" | 10 #include "cc/surfaces/sequence_surface_reference_factory.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 void CanvasSurfaceLayerBridge::createSolidColorLayer() { | 85 void CanvasSurfaceLayerBridge::createSolidColorLayer() { |
| 86 m_CCLayer = cc::SolidColorLayer::Create(); | 86 m_CCLayer = cc::SolidColorLayer::Create(); |
| 87 m_CCLayer->SetBackgroundColor(SK_ColorTRANSPARENT); | 87 m_CCLayer->SetBackgroundColor(SK_ColorTRANSPARENT); |
| 88 m_webLayer = Platform::current()->compositorSupport()->createLayerFromCCLayer( | 88 m_webLayer = Platform::current()->compositorSupport()->createLayerFromCCLayer( |
| 89 m_CCLayer.get()); | 89 m_CCLayer.get()); |
| 90 GraphicsLayer::registerContentsLayer(m_webLayer.get()); | 90 GraphicsLayer::registerContentsLayer(m_webLayer.get()); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void CanvasSurfaceLayerBridge::OnSurfaceCreated( | 93 void CanvasSurfaceLayerBridge::OnSurfaceCreated( |
| 94 const cc::SurfaceInfo& surfaceInfo) { | 94 const cc::SurfaceInfo& surfaceInfo) { |
| 95 if (!m_currentSurfaceId.is_valid() && surfaceInfo.id().is_valid()) { | 95 if (!m_currentSurfaceId.is_valid() && surfaceInfo.is_valid()) { |
| 96 // First time a SurfaceId is received | 96 // First time a SurfaceId is received |
| 97 m_currentSurfaceId = surfaceInfo.id(); | 97 m_currentSurfaceId = surfaceInfo.id(); |
| 98 GraphicsLayer::unregisterContentsLayer(m_webLayer.get()); | 98 GraphicsLayer::unregisterContentsLayer(m_webLayer.get()); |
| 99 m_webLayer->removeFromParent(); | 99 m_webLayer->removeFromParent(); |
| 100 | 100 |
| 101 scoped_refptr<cc::SurfaceLayer> surfaceLayer = | 101 scoped_refptr<cc::SurfaceLayer> surfaceLayer = |
| 102 cc::SurfaceLayer::Create(m_refFactory); | 102 cc::SurfaceLayer::Create(m_refFactory); |
| 103 surfaceLayer->SetPrimarySurfaceInfo(surfaceInfo); | 103 surfaceLayer->SetPrimarySurfaceInfo(surfaceInfo); |
| 104 surfaceLayer->SetStretchContentToFillBounds(true); | 104 surfaceLayer->SetStretchContentToFillBounds(true); |
| 105 m_CCLayer = surfaceLayer; | 105 m_CCLayer = surfaceLayer; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 126 m_service->Satisfy(sequence); | 126 m_service->Satisfy(sequence); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void CanvasSurfaceLayerBridge::requireCallback( | 129 void CanvasSurfaceLayerBridge::requireCallback( |
| 130 const cc::SurfaceId& surfaceId, | 130 const cc::SurfaceId& surfaceId, |
| 131 const cc::SurfaceSequence& sequence) { | 131 const cc::SurfaceSequence& sequence) { |
| 132 m_service->Require(surfaceId, sequence); | 132 m_service->Require(surfaceId, sequence); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace blink | 135 } // namespace blink |
| OLD | NEW |