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

Unified Diff: cc/layer_impl.cc

Issue 11365239: cc: Add support for debugging layer borders directly in the compositor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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
« no previous file with comments | « cc/layer_impl.h ('k') | cc/layer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_impl.cc
diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc
index ef4dee3f68d40a8b0ffb83633f568985c0fbd53c..72ef8818977e8cc3ba2862477bc5c9c3653bcfa0 100644
--- a/cc/layer_impl.cc
+++ b/cc/layer_impl.cc
@@ -54,8 +54,6 @@ LayerImpl::LayerImpl(int id)
, m_drawDepth(0)
, m_drawOpacity(0)
, m_drawOpacityIsAnimating(false)
- , m_debugBorderColor(0)
- , m_debugBorderWidth(0)
, m_filter(0)
, m_drawTransformIsAnimating(false)
, m_screenSpaceTransformIsAnimating(false)
@@ -146,13 +144,45 @@ void LayerImpl::didDraw(ResourceProvider*)
#endif
}
+bool LayerImpl::showDebugBorders() const
+{
+ if (!m_layerTreeHostImpl)
+ return false;
+ return m_layerTreeHostImpl->settings().showDebugBorders;
+}
+
+void LayerImpl::getDebugBorderProperties(SkColor* color, float* width) const
+{
+ if (m_drawsContent) {
+ // Non-tiled content layers are green.
+ *color = SkColorSetARGB(128, 0, 128, 32);
+ *width = 2;
+ return;
+ }
+
+ if (m_masksToBounds) {
+ // Masking layers are pale blue.
+ *color = SkColorSetARGB(48, 128, 255, 255);
+ *width = 20;
+ return;
+ }
+
+ // Other container layers are yellow.
+ *color = SkColorSetARGB(192, 255, 255, 0);
+ *width = 2;
+}
+
void LayerImpl::appendDebugBorderQuad(QuadSink& quadList, const SharedQuadState* sharedQuadState, AppendQuadsData& appendQuadsData) const
{
- if (!hasDebugBorders())
+ if (!showDebugBorders())
return;
+ SkColor color;
+ float width;
+ getDebugBorderProperties(&color, &width);
+
gfx::Rect contentRect(gfx::Point(), contentBounds());
- quadList.append(DebugBorderDrawQuad::create(sharedQuadState, contentRect, debugBorderColor(), debugBorderWidth()).PassAs<DrawQuad>(), appendQuadsData);
+ quadList.append(DebugBorderDrawQuad::create(sharedQuadState, contentRect, color, width).PassAs<DrawQuad>(), appendQuadsData);
}
bool LayerImpl::hasContributingDelegatedRenderPasses() const
@@ -587,29 +617,6 @@ bool LayerImpl::transformIsAnimating() const
return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Transform);
}
-void LayerImpl::setDebugBorderColor(SkColor debugBorderColor)
-{
- if (m_debugBorderColor == debugBorderColor)
- return;
-
- m_debugBorderColor = debugBorderColor;
- m_layerPropertyChanged = true;
-}
-
-void LayerImpl::setDebugBorderWidth(float debugBorderWidth)
-{
- if (m_debugBorderWidth == debugBorderWidth)
- return;
-
- m_debugBorderWidth = debugBorderWidth;
- m_layerPropertyChanged = true;
-}
-
-bool LayerImpl::hasDebugBorders() const
-{
- return SkColorGetA(m_debugBorderColor) && debugBorderWidth() > 0;
-}
-
void LayerImpl::setContentBounds(const gfx::Size& contentBounds)
{
if (m_contentBounds == contentBounds)
« no previous file with comments | « cc/layer_impl.h ('k') | cc/layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698