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

Side by Side Diff: ui/compositor/debug_utils.cc

Issue 23724024: Refactor TransformPoint{,Reverse}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and resolve conflicts. Created 7 years, 3 months 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 | « ui/base/events/event.cc ('k') | ui/compositor/layer.cc » ('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 (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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first.
6 6
7 #include "ui/compositor/debug_utils.h" 7 #include "ui/compositor/debug_utils.h"
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <iomanip> 10 #include <iomanip>
(...skipping 11 matching lines...) Expand all
22 namespace ui { 22 namespace ui {
23 23
24 namespace { 24 namespace {
25 25
26 void PrintLayerHierarchyImp(const Layer* layer, 26 void PrintLayerHierarchyImp(const Layer* layer,
27 int indent, 27 int indent,
28 gfx::Point mouse_location, 28 gfx::Point mouse_location,
29 std::wostringstream* out) { 29 std::wostringstream* out) {
30 std::string indent_str(indent, ' '); 30 std::string indent_str(indent, ' ');
31 31
32 layer->transform().TransformPointReverse(mouse_location); 32 layer->transform().TransformPointReverse(&mouse_location);
33 bool mouse_inside_layer_bounds = layer->bounds().Contains(mouse_location); 33 bool mouse_inside_layer_bounds = layer->bounds().Contains(mouse_location);
34 mouse_location.Offset(-layer->bounds().x(), -layer->bounds().y()); 34 mouse_location.Offset(-layer->bounds().x(), -layer->bounds().y());
35 35
36 *out << UTF8ToWide(indent_str); 36 *out << UTF8ToWide(indent_str);
37 if (mouse_inside_layer_bounds) 37 if (mouse_inside_layer_bounds)
38 *out << L'*'; 38 *out << L'*';
39 else 39 else
40 *out << L' '; 40 *out << L' ';
41 41
42 *out << UTF8ToWide(layer->name()) << L' ' << layer; 42 *out << UTF8ToWide(layer->name()) << L' ' << layer;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 void PrintLayerHierarchy(const Layer* layer, gfx::Point mouse_location) { 97 void PrintLayerHierarchy(const Layer* layer, gfx::Point mouse_location) {
98 std::wostringstream out; 98 std::wostringstream out;
99 out << L"Layer hierarchy:\n"; 99 out << L"Layer hierarchy:\n";
100 PrintLayerHierarchyImp(layer, 0, mouse_location, &out); 100 PrintLayerHierarchyImp(layer, 0, mouse_location, &out);
101 // Error so logs can be collected from end-users. 101 // Error so logs can be collected from end-users.
102 LOG(ERROR) << out.str(); 102 LOG(ERROR) << out.str();
103 } 103 }
104 104
105 } // namespace ui 105 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/events/event.cc ('k') | ui/compositor/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698