OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef NDEBUG | 5 #ifndef NDEBUG |
6 | 6 |
7 #include "ui/compositor/debug_utils.h" | 7 #include "ui/compositor/debug_utils.h" |
8 | 8 |
9 #include <iomanip> | 9 #include <iomanip> |
10 #include <iostream> | 10 #include <iostream> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "ui/compositor/layer.h" | 15 #include "ui/compositor/layer.h" |
16 #include "ui/gfx/interpolated_transform.h" | 16 #include "ui/gfx/interpolated_transform.h" |
17 #include "ui/gfx/point.h" | 17 #include "ui/gfx/point.h" |
18 #include "ui/gfx/transform.h" | 18 #include "ui/gfx/transform.h" |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 void PrintLayerHierarchyImp(const Layer* layer, int indent, | 24 void PrintLayerHierarchyImp(const Layer* layer, int indent, |
25 gfx::Point mouse_location) { | 25 gfx::Point mouse_location) { |
26 if (!layer->visible()) | |
27 return; | |
28 | |
29 std::wostringstream buf; | 26 std::wostringstream buf; |
30 std::string indent_str(indent, ' '); | 27 std::string indent_str(indent, ' '); |
31 std::string content_indent_str(indent+1, ' '); | 28 std::string content_indent_str(indent+1, ' '); |
32 | 29 |
33 layer->transform().TransformPointReverse(mouse_location); | 30 layer->transform().TransformPointReverse(mouse_location); |
34 bool mouse_inside_layer_bounds = layer->bounds().Contains(mouse_location); | 31 bool mouse_inside_layer_bounds = layer->bounds().Contains(mouse_location); |
35 mouse_location.Offset(-layer->bounds().x(), -layer->bounds().y()); | 32 mouse_location.Offset(-layer->bounds().x(), -layer->bounds().y()); |
36 | 33 |
37 buf << UTF8ToWide(indent_str); | 34 buf << UTF8ToWide(indent_str); |
38 if (mouse_inside_layer_bounds) | 35 if (mouse_inside_layer_bounds) |
(...skipping 10 matching lines...) Expand all Loading... |
49 case ui::LAYER_TEXTURED: | 46 case ui::LAYER_TEXTURED: |
50 buf << L" textured"; | 47 buf << L" textured"; |
51 if (layer->fills_bounds_opaquely()) | 48 if (layer->fills_bounds_opaquely()) |
52 buf << L" opaque"; | 49 buf << L" opaque"; |
53 break; | 50 break; |
54 case ui::LAYER_SOLID_COLOR: | 51 case ui::LAYER_SOLID_COLOR: |
55 buf << L" solid"; | 52 buf << L" solid"; |
56 break; | 53 break; |
57 } | 54 } |
58 | 55 |
| 56 if (!layer->visible()) |
| 57 buf << L" !visible"; |
| 58 |
59 buf << L'\n' << UTF8ToWide(content_indent_str); | 59 buf << L'\n' << UTF8ToWide(content_indent_str); |
60 buf << L"bounds: " << layer->bounds().x() << L',' << layer->bounds().y(); | 60 buf << L"bounds: " << layer->bounds().x() << L',' << layer->bounds().y(); |
61 buf << L' ' << layer->bounds().width() << L'x' << layer->bounds().height(); | 61 buf << L' ' << layer->bounds().width() << L'x' << layer->bounds().height(); |
62 | 62 |
63 if (layer->opacity() != 1.0f) { | 63 if (layer->opacity() != 1.0f) { |
64 buf << L'\n' << UTF8ToWide(content_indent_str); | 64 buf << L'\n' << UTF8ToWide(content_indent_str); |
65 buf << L"opacity: " << std::setprecision(2) << layer->opacity(); | 65 buf << L"opacity: " << std::setprecision(2) << layer->opacity(); |
66 } | 66 } |
67 | 67 |
68 if (layer->transform().HasChange()) { | 68 if (layer->transform().HasChange()) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 } // namespace | 101 } // namespace |
102 | 102 |
103 void PrintLayerHierarchy(const Layer* layer, gfx::Point mouse_location) { | 103 void PrintLayerHierarchy(const Layer* layer, gfx::Point mouse_location) { |
104 PrintLayerHierarchyImp(layer, 0, mouse_location); | 104 PrintLayerHierarchyImp(layer, 0, mouse_location); |
105 } | 105 } |
106 | 106 |
107 } // namespace ui | 107 } // namespace ui |
108 | 108 |
109 #endif // NDEBUG | 109 #endif // NDEBUG |
OLD | NEW |