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 "WebLayerImpl.h" | 8 #include "WebLayerImpl.h" |
9 #include "WebToCCInputHandlerAdapter.h" | 9 #include "WebToCCInputHandlerAdapter.h" |
10 #include "cc/font_atlas.h" | 10 #include "cc/font_atlas.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 { | 28 { |
29 scoped_ptr<WebLayerTreeViewImpl> layerTreeViewImpl(new WebLayerTreeViewImpl(
client)); | 29 scoped_ptr<WebLayerTreeViewImpl> layerTreeViewImpl(new WebLayerTreeViewImpl(
client)); |
30 if (!layerTreeViewImpl->initialize(settings)) | 30 if (!layerTreeViewImpl->initialize(settings)) |
31 return 0; | 31 return 0; |
32 layerTreeViewImpl->setRootLayer(root); | 32 layerTreeViewImpl->setRootLayer(root); |
33 return layerTreeViewImpl.release(); | 33 return layerTreeViewImpl.release(); |
34 } | 34 } |
35 | 35 |
36 WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client) | 36 WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client) |
37 : m_client(client) | 37 : m_client(client) |
| 38 , m_hasFontAtlas(false) |
38 { | 39 { |
39 } | 40 } |
40 | 41 |
41 WebLayerTreeViewImpl::~WebLayerTreeViewImpl() | 42 WebLayerTreeViewImpl::~WebLayerTreeViewImpl() |
42 { | 43 { |
43 } | 44 } |
44 | 45 |
45 bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti
ngs) | 46 bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSetti
ngs) |
46 { | 47 { |
47 CCLayerTreeSettings settings; | 48 CCLayerTreeSettings settings; |
48 settings.acceleratePainting = webSettings.acceleratePainting; | 49 settings.acceleratePainting = webSettings.acceleratePainting; |
49 settings.showFPSCounter = webSettings.showFPSCounter; | |
50 settings.showPlatformLayerTree = webSettings.showPlatformLayerTree; | 50 settings.showPlatformLayerTree = webSettings.showPlatformLayerTree; |
51 settings.showPaintRects = webSettings.showPaintRects; | 51 settings.showPaintRects = webSettings.showPaintRects; |
52 settings.renderVSyncEnabled = webSettings.renderVSyncEnabled; | 52 settings.renderVSyncEnabled = webSettings.renderVSyncEnabled; |
53 settings.refreshRate = webSettings.refreshRate; | 53 settings.refreshRate = webSettings.refreshRate; |
54 settings.defaultTileSize = convert(webSettings.defaultTileSize); | 54 settings.defaultTileSize = convert(webSettings.defaultTileSize); |
55 settings.maxUntiledLayerSize = convert(webSettings.maxUntiledLayerSize); | 55 settings.maxUntiledLayerSize = convert(webSettings.maxUntiledLayerSize); |
56 m_layerTreeHost = CCLayerTreeHost::create(this, settings); | 56 m_layerTreeHost = CCLayerTreeHost::create(this, settings); |
57 if (!m_layerTreeHost.get()) | 57 if (!m_layerTreeHost.get()) |
58 return false; | 58 return false; |
59 return true; | 59 return true; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 stats.numMainThreadScrolls = ccStats.numMainThreadScrolls; | 181 stats.numMainThreadScrolls = ccStats.numMainThreadScrolls; |
182 } | 182 } |
183 | 183 |
184 void WebLayerTreeViewImpl::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectT
able[128], int fontHeight) | 184 void WebLayerTreeViewImpl::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectT
able[128], int fontHeight) |
185 { | 185 { |
186 IntRect asciiToRectTable[128]; | 186 IntRect asciiToRectTable[128]; |
187 for (int i = 0; i < 128; ++i) | 187 for (int i = 0; i < 128; ++i) |
188 asciiToRectTable[i] = convert(asciiToWebRectTable[i]); | 188 asciiToRectTable[i] = convert(asciiToWebRectTable[i]); |
189 scoped_ptr<CCFontAtlas> fontAtlas = CCFontAtlas::create(bitmap, asciiToRectT
able, fontHeight); | 189 scoped_ptr<CCFontAtlas> fontAtlas = CCFontAtlas::create(bitmap, asciiToRectT
able, fontHeight); |
190 m_layerTreeHost->setFontAtlas(fontAtlas.Pass()); | 190 m_layerTreeHost->setFontAtlas(fontAtlas.Pass()); |
| 191 m_hasFontAtlas = true; |
191 } | 192 } |
192 | 193 |
193 void WebLayerTreeViewImpl::loseCompositorContext(int numTimes) | 194 void WebLayerTreeViewImpl::loseCompositorContext(int numTimes) |
194 { | 195 { |
195 m_layerTreeHost->loseContext(numTimes); | 196 m_layerTreeHost->loseContext(numTimes); |
196 } | 197 } |
197 | 198 |
| 199 void WebLayerTreeViewImpl::setShowFPSCounter(bool show) |
| 200 { |
| 201 m_layerTreeHost->setShowFPSCounter(show); |
| 202 } |
| 203 |
| 204 bool WebLayerTreeViewImpl::hasFontAtlas() |
| 205 { |
| 206 return m_hasFontAtlas; |
| 207 } |
| 208 |
198 void WebLayerTreeViewImpl::willBeginFrame() | 209 void WebLayerTreeViewImpl::willBeginFrame() |
199 { | 210 { |
200 m_client->willBeginFrame(); | 211 m_client->willBeginFrame(); |
201 } | 212 } |
202 | 213 |
203 void WebLayerTreeViewImpl::didBeginFrame() | 214 void WebLayerTreeViewImpl::didBeginFrame() |
204 { | 215 { |
205 m_client->didBeginFrame(); | 216 m_client->didBeginFrame(); |
206 } | 217 } |
207 | 218 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 { | 269 { |
259 m_client->didCompleteSwapBuffers(); | 270 m_client->didCompleteSwapBuffers(); |
260 } | 271 } |
261 | 272 |
262 void WebLayerTreeViewImpl::scheduleComposite() | 273 void WebLayerTreeViewImpl::scheduleComposite() |
263 { | 274 { |
264 m_client->scheduleComposite(); | 275 m_client->scheduleComposite(); |
265 } | 276 } |
266 | 277 |
267 } // namespace WebKit | 278 } // namespace WebKit |
OLD | NEW |