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

Unified Diff: cc/heads_up_display_layer.cc

Issue 11414017: cc: handling debug settings in new LayerTreeDebugState structure (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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: cc/heads_up_display_layer.cc
diff --git a/cc/heads_up_display_layer.cc b/cc/heads_up_display_layer.cc
index ef11deecaec42f4ce08121046f0d35e2a4a82da0..12be3eab4a8f9ab9f5c622a365b0223b1e6fcdbb 100644
--- a/cc/heads_up_display_layer.cc
+++ b/cc/heads_up_display_layer.cc
@@ -10,6 +10,29 @@
namespace cc {
+HeadsUpDisplayLayerFlags::HeadsUpDisplayLayerFlags()
+ : showFPSCounter(false)
+ , showPlatformLayerTree(false)
+ , showPaintRects(false)
+ , showPropertyChangedRects(false)
+ , showSurfaceDamageRects(false)
+ , showScreenSpaceRects(false)
+ , showReplicaScreenSpaceRects(false)
+ , showOccludingRects(false)
+ , showNonOccludingRects(false)
+{
+}
+
+bool HeadsUpDisplayLayerFlags::showDebugInfo() const
+{
+ return showFPSCounter || showPlatformLayerTree || showDebugRects();
+}
+
+bool HeadsUpDisplayLayerFlags::showDebugRects() const
+{
+ return showPaintRects || showPropertyChangedRects || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceRects || showOccludingRects || showNonOccludingRects;
+}
+
scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::create()
{
return make_scoped_refptr(new HeadsUpDisplayLayer());
@@ -17,7 +40,6 @@ scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::create()
HeadsUpDisplayLayer::HeadsUpDisplayLayer()
: Layer()
- , m_showFPSCounter(false)
{
setBounds(gfx::Size(256, 128));
}
@@ -28,14 +50,13 @@ HeadsUpDisplayLayer::~HeadsUpDisplayLayer()
void HeadsUpDisplayLayer::update(ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&)
{
- const LayerTreeSettings& settings = layerTreeHost()->settings();
int maxTextureSize = layerTreeHost()->rendererCapabilities().maxTextureSize;
gfx::Size bounds;
WebKit::WebTransformationMatrix matrix;
matrix.makeIdentity();
- if (settings.showPlatformLayerTree || settings.showDebugRects()) {
+ if (m_flags.showPlatformLayerTree || m_flags.showDebugRects()) {
int width = std::min(maxTextureSize, layerTreeHost()->deviceViewportSize().width());
int height = std::min(maxTextureSize, layerTreeHost()->deviceViewportSize().height());
bounds = gfx::Size(width, height);
@@ -53,6 +74,11 @@ bool HeadsUpDisplayLayer::drawsContent() const
return true;
}
+void HeadsUpDisplayLayer::setFlags(HeadsUpDisplayLayerFlags& flags)
+{
+ m_flags = flags;
+}
+
void HeadsUpDisplayLayer::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas)
{
m_fontAtlas = fontAtlas.Pass();
@@ -61,7 +87,19 @@ void HeadsUpDisplayLayer::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas)
void HeadsUpDisplayLayer::setShowFPSCounter(bool show)
{
- m_showFPSCounter = show;
+ m_flags.showFPSCounter = show;
+ setNeedsCommit();
+}
+
+void HeadsUpDisplayLayer::setShowPaintRects(bool show)
+{
+ m_flags.showPaintRects = show;
+ setNeedsCommit();
+}
+
+void HeadsUpDisplayLayer::setShowPlatformLayerTree(bool show)
+{
+ m_flags.showPlatformLayerTree = show;
setNeedsCommit();
}
@@ -75,7 +113,7 @@ void HeadsUpDisplayLayer::pushPropertiesTo(LayerImpl* layerImpl)
Layer::pushPropertiesTo(layerImpl);
HeadsUpDisplayLayerImpl* hudLayerImpl = static_cast<HeadsUpDisplayLayerImpl*>(layerImpl);
- hudLayerImpl->setShowFPSCounter(m_showFPSCounter);
+ hudLayerImpl->setFlags(m_flags);
if (m_fontAtlas.get())
hudLayerImpl->setFontAtlas(m_fontAtlas.Pass());

Powered by Google App Engine
This is Rietveld 408576698