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

Side by Side Diff: cc/layer_tree_host.cc

Issue 11413123: cc: switch to new WebLayerTreeViewClient API for requesting font atlas (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixing tests Created 8 years 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 unified diff | Download patch
« no previous file with comments | « cc/layer_tree_host.h ('k') | cc/layer_tree_host_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "cc/layer_tree_host.h" 5 #include "cc/layer_tree_host.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "cc/font_atlas.h" 10 #include "cc/font_atlas.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 bool LayerTreeDebugState::showHudInfo() const 57 bool LayerTreeDebugState::showHudInfo() const
58 { 58 {
59 return showFPSCounter || showPlatformLayerTree || showHudRects(); 59 return showFPSCounter || showPlatformLayerTree || showHudRects();
60 } 60 }
61 61
62 bool LayerTreeDebugState::showHudRects() const 62 bool LayerTreeDebugState::showHudRects() const
63 { 63 {
64 return showPaintRects || showPropertyChangedRects || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceRects || showOccludingRects || showNonOccludingRects; 64 return showPaintRects || showPropertyChangedRects || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceRects || showOccludingRects || showNonOccludingRects;
65 } 65 }
66 66
67 bool LayerTreeDebugState::hudNeedsFont() const
68 {
69 return showFPSCounter || showPlatformLayerTree;
70 }
71
67 bool LayerTreeDebugState::equal(const LayerTreeDebugState& a, const LayerTreeDeb ugState& b) 72 bool LayerTreeDebugState::equal(const LayerTreeDebugState& a, const LayerTreeDeb ugState& b)
68 { 73 {
69 return memcmp(&a, &b, sizeof(LayerTreeDebugState)) == 0; 74 return memcmp(&a, &b, sizeof(LayerTreeDebugState)) == 0;
70 } 75 }
71 76
72 LayerTreeDebugState LayerTreeDebugState::unite(const LayerTreeDebugState& a, con st LayerTreeDebugState& b) 77 LayerTreeDebugState LayerTreeDebugState::unite(const LayerTreeDebugState& a, con st LayerTreeDebugState& b)
73 { 78 {
74 LayerTreeDebugState r(a); 79 LayerTreeDebugState r(a);
75 80
76 r.showFPSCounter |= b.showFPSCounter; 81 r.showFPSCounter |= b.showFPSCounter;
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 hostImpl->setViewportSize(layoutViewportSize(), deviceViewportSize()); 337 hostImpl->setViewportSize(layoutViewportSize(), deviceViewportSize());
333 hostImpl->setDeviceScaleFactor(deviceScaleFactor()); 338 hostImpl->setDeviceScaleFactor(deviceScaleFactor());
334 hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFacto r, m_maxPageScaleFactor); 339 hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFacto r, m_maxPageScaleFactor);
335 hostImpl->setBackgroundColor(m_backgroundColor); 340 hostImpl->setBackgroundColor(m_backgroundColor);
336 hostImpl->setHasTransparentBackground(m_hasTransparentBackground); 341 hostImpl->setHasTransparentBackground(m_hasTransparentBackground);
337 hostImpl->setDebugState(m_debugState); 342 hostImpl->setDebugState(m_debugState);
338 343
339 m_commitNumber++; 344 m_commitNumber++;
340 } 345 }
341 346
342 void LayerTreeHost::createHUDLayerIfNeeded()
343 {
344 if (!m_hudLayer)
345 m_hudLayer = HeadsUpDisplayLayer::create();
346 }
347
348 void LayerTreeHost::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas)
349 {
350 createHUDLayerIfNeeded();
351 m_hudLayer->setFontAtlas(fontAtlas.Pass());
352 }
353
354 void LayerTreeHost::willCommit() 347 void LayerTreeHost::willCommit()
egraether 2012/11/30 21:27:56 With LayerTreeDebugState and font atlas creation o
355 { 348 {
356 m_client->willCommit(); 349 m_client->willCommit();
357 350
358 if (m_debugState.showHudInfo()) 351 if (m_debugState.showHudInfo()) {
359 createHUDLayerIfNeeded(); 352 if (!m_hudLayer)
353 m_hudLayer = HeadsUpDisplayLayer::create();
360 354
361 if (m_rootLayer && m_hudLayer && !m_hudLayer->parent()) 355 if (m_debugState.hudNeedsFont() && !m_hudLayer->hasFontAtlas())
362 m_rootLayer->addChild(m_hudLayer); 356 m_hudLayer->setFontAtlas(m_client->createFontAtlas());
357
358 if (m_rootLayer && !m_hudLayer->parent())
359 m_rootLayer->addChild(m_hudLayer);
360 } else if (m_hudLayer) {
361 m_hudLayer->removeFromParent();
362 m_hudLayer = 0;
egraether 2012/11/30 21:27:56 The hudLayer gets released when no longer needed,
363 }
363 } 364 }
364 365
365 void LayerTreeHost::commitComplete() 366 void LayerTreeHost::commitComplete()
366 { 367 {
367 m_client->didCommit(); 368 m_client->didCommit();
368 } 369 }
369 370
370 scoped_ptr<GraphicsContext> LayerTreeHost::createContext() 371 scoped_ptr<GraphicsContext> LayerTreeHost::createContext()
371 { 372 {
372 return m_client->createOutputSurface(); 373 return m_client->createOutputSurface();
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 else 909 else
909 layer->notifyAnimationFinished(wallClockTime.ToDoubleT()); 910 layer->notifyAnimationFinished(wallClockTime.ToDoubleT());
910 } 911 }
911 } 912 }
912 913
913 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) 914 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex)
914 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); 915 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime);
915 } 916 }
916 917
917 } // namespace cc 918 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layer_tree_host.h ('k') | cc/layer_tree_host_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698