OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "config.h" | 5 #include "config.h" |
6 #include "WebLayerTreeViewImpl.h" | 6 #include "WebLayerTreeViewImpl.h" |
7 | 7 |
8 #include "CCFontAtlas.h" | 8 #include "CCFontAtlas.h" |
9 #include "CCInputHandler.h" | 9 #include "CCInputHandler.h" |
10 #include "CCLayerTreeHost.h" | 10 #include "CCLayerTreeHost.h" |
11 #include "LayerChromium.h" | 11 #include "LayerChromium.h" |
12 #include "WebLayerImpl.h" | 12 #include "WebLayerImpl.h" |
13 #include "WebToCCInputHandlerAdapter.h" | 13 #include "WebToCCInputHandlerAdapter.h" |
| 14 #include "webcore_convert.h" |
14 #include <public/WebGraphicsContext3D.h> | 15 #include <public/WebGraphicsContext3D.h> |
15 #include <public/WebInputHandler.h> | 16 #include <public/WebInputHandler.h> |
16 #include <public/WebLayer.h> | 17 #include <public/WebLayer.h> |
17 #include <public/WebLayerTreeView.h> | 18 #include <public/WebLayerTreeView.h> |
18 #include <public/WebLayerTreeViewClient.h> | 19 #include <public/WebLayerTreeViewClient.h> |
19 #include <public/WebRenderingStats.h> | 20 #include <public/WebRenderingStats.h> |
20 #include <public/WebSize.h> | 21 #include <public/WebSize.h> |
21 | 22 |
22 using namespace WebCore; | 23 using namespace WebCore; |
23 | 24 |
(...skipping 19 matching lines...) Expand all Loading... |
43 | 44 |
44 bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti
ngs) | 45 bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti
ngs) |
45 { | 46 { |
46 CCLayerTreeSettings settings; | 47 CCLayerTreeSettings settings; |
47 settings.acceleratePainting = webSettings.acceleratePainting; | 48 settings.acceleratePainting = webSettings.acceleratePainting; |
48 settings.showFPSCounter = webSettings.showFPSCounter; | 49 settings.showFPSCounter = webSettings.showFPSCounter; |
49 settings.showPlatformLayerTree = webSettings.showPlatformLayerTree; | 50 settings.showPlatformLayerTree = webSettings.showPlatformLayerTree; |
50 settings.showPaintRects = webSettings.showPaintRects; | 51 settings.showPaintRects = webSettings.showPaintRects; |
51 settings.renderVSyncEnabled = webSettings.renderVSyncEnabled; | 52 settings.renderVSyncEnabled = webSettings.renderVSyncEnabled; |
52 settings.refreshRate = webSettings.refreshRate; | 53 settings.refreshRate = webSettings.refreshRate; |
53 settings.defaultTileSize = webSettings.defaultTileSize; | 54 settings.defaultTileSize = convert(webSettings.defaultTileSize); |
54 settings.maxUntiledLayerSize = webSettings.maxUntiledLayerSize; | 55 settings.maxUntiledLayerSize = convert(webSettings.maxUntiledLayerSize); |
55 m_layerTreeHost = CCLayerTreeHost::create(this, settings); | 56 m_layerTreeHost = CCLayerTreeHost::create(this, settings); |
56 if (!m_layerTreeHost) | 57 if (!m_layerTreeHost) |
57 return false; | 58 return false; |
58 return true; | 59 return true; |
59 } | 60 } |
60 | 61 |
61 void WebLayerTreeViewImpl::setSurfaceReady() | 62 void WebLayerTreeViewImpl::setSurfaceReady() |
62 { | 63 { |
63 m_layerTreeHost->setSurfaceReady(); | 64 m_layerTreeHost->setSurfaceReady(); |
64 } | 65 } |
65 | 66 |
66 void WebLayerTreeViewImpl::setRootLayer(const WebLayer& root) | 67 void WebLayerTreeViewImpl::setRootLayer(const WebLayer& root) |
67 { | 68 { |
68 m_layerTreeHost->setRootLayer(static_cast<const WebLayerImpl*>(&root)->layer
()); | 69 m_layerTreeHost->setRootLayer(static_cast<const WebLayerImpl*>(&root)->layer
()); |
69 } | 70 } |
70 | 71 |
71 void WebLayerTreeViewImpl::clearRootLayer() | 72 void WebLayerTreeViewImpl::clearRootLayer() |
72 { | 73 { |
73 m_layerTreeHost->setRootLayer(PassRefPtr<LayerChromium>()); | 74 m_layerTreeHost->setRootLayer(PassRefPtr<LayerChromium>()); |
74 } | 75 } |
75 | 76 |
76 void WebLayerTreeViewImpl::setViewportSize(const WebSize& layoutViewportSize, co
nst WebSize& deviceViewportSize) | 77 void WebLayerTreeViewImpl::setViewportSize(const WebSize& layoutViewportSize, co
nst WebSize& deviceViewportSize) |
77 { | 78 { |
78 if (!deviceViewportSize.isEmpty()) | 79 if (!deviceViewportSize.isEmpty()) |
79 m_layerTreeHost->setViewportSize(layoutViewportSize, deviceViewportSize)
; | 80 m_layerTreeHost->setViewportSize(convert(layoutViewportSize), convert(de
viceViewportSize)); |
80 else | 81 else |
81 m_layerTreeHost->setViewportSize(layoutViewportSize, layoutViewportSize)
; | 82 m_layerTreeHost->setViewportSize(convert(layoutViewportSize), convert(la
youtViewportSize)); |
82 } | 83 } |
83 | 84 |
84 WebSize WebLayerTreeViewImpl::layoutViewportSize() const | 85 WebSize WebLayerTreeViewImpl::layoutViewportSize() const |
85 { | 86 { |
86 return WebSize(m_layerTreeHost->layoutViewportSize()); | 87 return convert(m_layerTreeHost->layoutViewportSize()); |
87 } | 88 } |
88 | 89 |
89 WebSize WebLayerTreeViewImpl::deviceViewportSize() const | 90 WebSize WebLayerTreeViewImpl::deviceViewportSize() const |
90 { | 91 { |
91 return WebSize(m_layerTreeHost->deviceViewportSize()); | 92 return convert(m_layerTreeHost->deviceViewportSize()); |
92 } | 93 } |
93 | 94 |
94 void WebLayerTreeViewImpl::setDeviceScaleFactor(const float deviceScaleFactor) | 95 void WebLayerTreeViewImpl::setDeviceScaleFactor(const float deviceScaleFactor) |
95 { | 96 { |
96 m_layerTreeHost->setDeviceScaleFactor(deviceScaleFactor); | 97 m_layerTreeHost->setDeviceScaleFactor(deviceScaleFactor); |
97 } | 98 } |
98 | 99 |
99 float WebLayerTreeViewImpl::deviceScaleFactor() const | 100 float WebLayerTreeViewImpl::deviceScaleFactor() const |
100 { | 101 { |
101 return m_layerTreeHost->deviceScaleFactor(); | 102 return m_layerTreeHost->deviceScaleFactor(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 m_layerTreeHost->composite(); | 150 m_layerTreeHost->composite(); |
150 } | 151 } |
151 | 152 |
152 void WebLayerTreeViewImpl::updateAnimations(double frameBeginTime) | 153 void WebLayerTreeViewImpl::updateAnimations(double frameBeginTime) |
153 { | 154 { |
154 m_layerTreeHost->updateAnimations(frameBeginTime); | 155 m_layerTreeHost->updateAnimations(frameBeginTime); |
155 } | 156 } |
156 | 157 |
157 bool WebLayerTreeViewImpl::compositeAndReadback(void *pixels, const WebRect& rec
t) | 158 bool WebLayerTreeViewImpl::compositeAndReadback(void *pixels, const WebRect& rec
t) |
158 { | 159 { |
159 return m_layerTreeHost->compositeAndReadback(pixels, rect); | 160 return m_layerTreeHost->compositeAndReadback(pixels, convert(rect)); |
160 } | 161 } |
161 | 162 |
162 void WebLayerTreeViewImpl::finishAllRendering() | 163 void WebLayerTreeViewImpl::finishAllRendering() |
163 { | 164 { |
164 m_layerTreeHost->finishAllRendering(); | 165 m_layerTreeHost->finishAllRendering(); |
165 } | 166 } |
166 | 167 |
167 void WebLayerTreeViewImpl::renderingStats(WebRenderingStats& stats) const | 168 void WebLayerTreeViewImpl::renderingStats(WebRenderingStats& stats) const |
168 { | 169 { |
169 CCRenderingStats ccStats; | 170 CCRenderingStats ccStats; |
170 m_layerTreeHost->renderingStats(ccStats); | 171 m_layerTreeHost->renderingStats(ccStats); |
171 | 172 |
172 stats.numAnimationFrames = ccStats.numAnimationFrames; | 173 stats.numAnimationFrames = ccStats.numAnimationFrames; |
173 stats.numFramesSentToScreen = ccStats.numFramesSentToScreen; | 174 stats.numFramesSentToScreen = ccStats.numFramesSentToScreen; |
174 stats.droppedFrameCount = ccStats.droppedFrameCount; | 175 stats.droppedFrameCount = ccStats.droppedFrameCount; |
175 stats.totalPaintTimeInSeconds = ccStats.totalPaintTimeInSeconds; | 176 stats.totalPaintTimeInSeconds = ccStats.totalPaintTimeInSeconds; |
176 stats.totalRasterizeTimeInSeconds = ccStats.totalRasterizeTimeInSeconds; | 177 stats.totalRasterizeTimeInSeconds = ccStats.totalRasterizeTimeInSeconds; |
177 } | 178 } |
178 | 179 |
179 void WebLayerTreeViewImpl::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectT
able[128], int fontHeight) | 180 void WebLayerTreeViewImpl::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectT
able[128], int fontHeight) |
180 { | 181 { |
181 IntRect asciiToRectTable[128]; | 182 IntRect asciiToRectTable[128]; |
182 for (int i = 0; i < 128; ++i) | 183 for (int i = 0; i < 128; ++i) |
183 asciiToRectTable[i] = asciiToWebRectTable[i]; | 184 asciiToRectTable[i] = convert(asciiToWebRectTable[i]); |
184 OwnPtr<CCFontAtlas> fontAtlas = CCFontAtlas::create(bitmap, asciiToRectTable
, fontHeight); | 185 OwnPtr<CCFontAtlas> fontAtlas = CCFontAtlas::create(bitmap, asciiToRectTable
, fontHeight); |
185 m_layerTreeHost->setFontAtlas(fontAtlas.release()); | 186 m_layerTreeHost->setFontAtlas(fontAtlas.release()); |
186 } | 187 } |
187 | 188 |
188 void WebLayerTreeViewImpl::loseCompositorContext(int numTimes) | 189 void WebLayerTreeViewImpl::loseCompositorContext(int numTimes) |
189 { | 190 { |
190 m_layerTreeHost->loseContext(numTimes); | 191 m_layerTreeHost->loseContext(numTimes); |
191 } | 192 } |
192 | 193 |
193 void WebLayerTreeViewImpl::willBeginFrame() | 194 void WebLayerTreeViewImpl::willBeginFrame() |
(...skipping 11 matching lines...) Expand all Loading... |
205 m_client->updateAnimations(monotonicFrameBeginTime); | 206 m_client->updateAnimations(monotonicFrameBeginTime); |
206 } | 207 } |
207 | 208 |
208 void WebLayerTreeViewImpl::layout() | 209 void WebLayerTreeViewImpl::layout() |
209 { | 210 { |
210 m_client->layout(); | 211 m_client->layout(); |
211 } | 212 } |
212 | 213 |
213 void WebLayerTreeViewImpl::applyScrollAndScale(const WebCore::IntSize& scrollDel
ta, float pageScale) | 214 void WebLayerTreeViewImpl::applyScrollAndScale(const WebCore::IntSize& scrollDel
ta, float pageScale) |
214 { | 215 { |
215 m_client->applyScrollAndScale(scrollDelta, pageScale); | 216 m_client->applyScrollAndScale(convert(scrollDelta), pageScale); |
216 } | 217 } |
217 | 218 |
218 PassOwnPtr<WebCompositorOutputSurface> WebLayerTreeViewImpl::createOutputSurface
() | 219 PassOwnPtr<WebCompositorOutputSurface> WebLayerTreeViewImpl::createOutputSurface
() |
219 { | 220 { |
220 return adoptPtr(m_client->createOutputSurface()); | 221 return adoptPtr(m_client->createOutputSurface()); |
221 } | 222 } |
222 | 223 |
223 void WebLayerTreeViewImpl::didRecreateOutputSurface(bool success) | 224 void WebLayerTreeViewImpl::didRecreateOutputSurface(bool success) |
224 { | 225 { |
225 m_client->didRecreateOutputSurface(success); | 226 m_client->didRecreateOutputSurface(success); |
(...skipping 26 matching lines...) Expand all Loading... |
252 { | 253 { |
253 m_client->didCompleteSwapBuffers(); | 254 m_client->didCompleteSwapBuffers(); |
254 } | 255 } |
255 | 256 |
256 void WebLayerTreeViewImpl::scheduleComposite() | 257 void WebLayerTreeViewImpl::scheduleComposite() |
257 { | 258 { |
258 m_client->scheduleComposite(); | 259 m_client->scheduleComposite(); |
259 } | 260 } |
260 | 261 |
261 } // namespace WebKit | 262 } // namespace WebKit |
OLD | NEW |