OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "ash/touch/touch_hud_debug.h" | 5 #include "ash/touch/touch_hud_debug.h" |
6 | 6 |
7 #include "ash/display/display_manager.h" | 7 #include "ash/display/display_manager.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 public: | 250 public: |
251 explicit TouchHudCanvas(const TouchLog& touch_log) | 251 explicit TouchHudCanvas(const TouchLog& touch_log) |
252 : touch_log_(touch_log), | 252 : touch_log_(touch_log), |
253 scale_(1) { | 253 scale_(1) { |
254 SetPaintToLayer(true); | 254 SetPaintToLayer(true); |
255 SetFillsBoundsOpaquely(false); | 255 SetFillsBoundsOpaquely(false); |
256 | 256 |
257 paint_.setStyle(SkPaint::kFill_Style); | 257 paint_.setStyle(SkPaint::kFill_Style); |
258 } | 258 } |
259 | 259 |
260 virtual ~TouchHudCanvas() {} | 260 ~TouchHudCanvas() override {} |
261 | 261 |
262 void SetScale(int scale) { | 262 void SetScale(int scale) { |
263 if (scale_ == scale) | 263 if (scale_ == scale) |
264 return; | 264 return; |
265 scale_ = scale; | 265 scale_ = scale; |
266 gfx::Transform transform; | 266 gfx::Transform transform; |
267 transform.Scale(1. / scale_, 1. / scale_); | 267 transform.Scale(1. / scale_, 1. / scale_); |
268 layer()->SetTransform(transform); | 268 layer()->SetTransform(transform); |
269 } | 269 } |
270 | 270 |
(...skipping 30 matching lines...) Expand all Loading... |
301 SkScalar y = SkIntToScalar(location.y()); | 301 SkScalar y = SkIntToScalar(location.y()); |
302 SkPoint last; | 302 SkPoint last; |
303 if (!paths_[trace_index].getLastPt(&last) || x != last.x() || | 303 if (!paths_[trace_index].getLastPt(&last) || x != last.x() || |
304 y != last.y()) { | 304 y != last.y()) { |
305 paths_[trace_index].addCircle(x, y, SkIntToScalar(kPointRadius)); | 305 paths_[trace_index].addCircle(x, y, SkIntToScalar(kPointRadius)); |
306 SchedulePaint(); | 306 SchedulePaint(); |
307 } | 307 } |
308 } | 308 } |
309 | 309 |
310 // Overridden from views::View. | 310 // Overridden from views::View. |
311 virtual void OnPaint(gfx::Canvas* canvas) override { | 311 void OnPaint(gfx::Canvas* canvas) override { |
312 for (int i = 0; i < kMaxPaths; ++i) { | 312 for (int i = 0; i < kMaxPaths; ++i) { |
313 if (paths_[i].countPoints() == 0) | 313 if (paths_[i].countPoints() == 0) |
314 continue; | 314 continue; |
315 paint_.setColor(colors_[i]); | 315 paint_.setColor(colors_[i]); |
316 canvas->DrawPath(paths_[i], paint_); | 316 canvas->DrawPath(paths_[i], paint_); |
317 } | 317 } |
318 } | 318 } |
319 | 319 |
320 SkPaint paint_; | 320 SkPaint paint_; |
321 | 321 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 RootWindowController* controller) { | 479 RootWindowController* controller) { |
480 controller->set_touch_hud_debug(this); | 480 controller->set_touch_hud_debug(this); |
481 } | 481 } |
482 | 482 |
483 void TouchHudDebug::UnsetHudForRootWindowController( | 483 void TouchHudDebug::UnsetHudForRootWindowController( |
484 RootWindowController* controller) { | 484 RootWindowController* controller) { |
485 controller->set_touch_hud_debug(NULL); | 485 controller->set_touch_hud_debug(NULL); |
486 } | 486 } |
487 | 487 |
488 } // namespace ash | 488 } // namespace ash |
OLD | NEW |