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

Unified Diff: third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp

Issue 2610723002: Unify SurfaceInfo (Closed)
Patch Set: Cleanup offscreen canvas Created 3 years, 12 months 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp
index 028055ba6af67633e01f76b89b384e9825257b4f..3351fcd7e1bb6191978ec7aafd981aa72e185916 100644
--- a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp
+++ b/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp
@@ -84,42 +84,36 @@ void CanvasSurfaceLayerBridge::createSolidColorLayer() {
GraphicsLayer::registerContentsLayer(m_webLayer.get());
}
-void CanvasSurfaceLayerBridge::OnSurfaceCreated(const cc::SurfaceId& surfaceId,
- int32_t width,
- int32_t height,
- float deviceScaleFactor) {
- if (!m_currentSurfaceId.is_valid() && surfaceId.is_valid()) {
+void CanvasSurfaceLayerBridge::OnSurfaceCreated(
+ const cc::SurfaceInfo& surfaceInfo) {
+ if (!m_currentSurfaceId.is_valid() && surfaceInfo.id().is_valid()) {
// First time a SurfaceId is received
- m_currentSurfaceId = surfaceId;
+ m_currentSurfaceId = surfaceInfo.id();
GraphicsLayer::unregisterContentsLayer(m_webLayer.get());
m_webLayer->removeFromParent();
scoped_refptr<cc::SurfaceLayer> surfaceLayer =
cc::SurfaceLayer::Create(m_refFactory);
- cc::SurfaceInfo info(surfaceId, deviceScaleFactor,
- gfx::Size(width, height));
surfaceLayer->SetSurfaceInfo(
- info, true /* scale layer bounds with surface size */);
+ surfaceInfo, true /* scale layer bounds with surface size */);
m_CCLayer = surfaceLayer;
m_webLayer =
Platform::current()->compositorSupport()->createLayerFromCCLayer(
m_CCLayer.get());
GraphicsLayer::registerContentsLayer(m_webLayer.get());
- } else if (m_currentSurfaceId != surfaceId) {
+ } else if (m_currentSurfaceId != surfaceInfo.id()) {
// A different SurfaceId is received, prompting change to existing
// SurfaceLayer
- m_currentSurfaceId = surfaceId;
- cc::SurfaceInfo info(m_currentSurfaceId, deviceScaleFactor,
- gfx::Size(width, height));
+ m_currentSurfaceId = surfaceInfo.id();
cc::SurfaceLayer* surfaceLayer =
static_cast<cc::SurfaceLayer*>(m_CCLayer.get());
surfaceLayer->SetSurfaceInfo(
- info, true /* scale layer bounds with surface size */);
+ surfaceInfo, true /* scale layer bounds with surface size */);
}
m_observer->OnWebLayerReplaced();
- m_CCLayer->SetBounds(gfx::Size(width, height));
+ m_CCLayer->SetBounds(surfaceInfo.size_in_pixels());
}
void CanvasSurfaceLayerBridge::satisfyCallback(
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.h ('k') | third_party/WebKit/public/blink_typemaps.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698