diff options
author | 2010-02-24 02:01:23 +0000 | |
---|---|---|
committer | 2010-02-24 02:01:23 +0000 | |
commit | 2bd703b3163fe1da3ea55f6459c5e162f32cce12 (patch) | |
tree | bd0fc1fb65ed1522c0755be7e744a79952dbf199 /src/utils | |
parent | 233481ebd0b8644a319443cde33e75266e990ee6 (diff) |
add DEBUG_LAYER_BOUNDS option to show layer bounds
git-svn-id: http://skia.googlecode.com/svn/trunk@509 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/SkLayer.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/utils/SkLayer.cpp b/src/utils/SkLayer.cpp index 603cdd1eb8..759f826d96 100644 --- a/src/utils/SkLayer.cpp +++ b/src/utils/SkLayer.cpp @@ -1,11 +1,13 @@ #include "SkLayer.h" #include "SkCanvas.h" +//#define DEBUG_LAYER_BOUNDS + SkLayer::SkLayer() { - m_opacity = 1; + m_opacity = SK_Scalar1; m_size.set(0, 0); m_position.set(0, 0); - m_anchorPoint.set(0.5, 0.5); + m_anchorPoint.set(SK_ScalarHalf, SK_ScalarHalf); fMatrix.reset(); fChildrenMatrix.reset(); @@ -102,6 +104,20 @@ void SkLayer::draw(SkCanvas* canvas, SkScalar opacity) { this->onDraw(canvas, opacity); +#ifdef DEBUG_LAYER_BOUNDS + { + SkRect r = SkRect::MakeSize(this->getSize()); + SkPaint p; + p.setAntiAlias(true); + p.setStyle(SkPaint::kStroke_Style); + p.setStrokeWidth(SkIntToScalar(2)); + p.setColor(0xFFFF44DD); + canvas->drawRect(r, p); + canvas->drawLine(r.fLeft, r.fTop, r.fRight, r.fBottom, p); + canvas->drawLine(r.fLeft, r.fBottom, r.fRight, r.fTop, p); + } +#endif + int count = this->countChildren(); if (count > 0) { canvas->concat(this->getChildrenMatrix()); |