| 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 #include "ash/common/system/chromeos/network/network_icon.h" | 5 #include "ash/common/system/chromeos/network/network_icon.h" |
| 6 | 6 |
| 7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/system/chromeos/network/network_icon_animation.h" | 8 #include "ash/common/system/chromeos/network/network_icon_animation.h" |
| 9 #include "ash/common/system/chromeos/network/network_icon_animation_observer.h" | 9 #include "ash/common/system/chromeos/network/network_icon_animation_observer.h" |
| 10 #include "ash/common/system/tray/tray_constants.h" | 10 #include "ash/common/system/tray/tray_constants.h" |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 | 388 |
| 389 auto make_triangle = [scale, kFullTriangleSide](SkScalar side) { | 389 auto make_triangle = [scale, kFullTriangleSide](SkScalar side) { |
| 390 SkPath triangle; | 390 SkPath triangle; |
| 391 triangle.moveTo(scale(kIconInset), scale(kIconInset + kFullTriangleSide)); | 391 triangle.moveTo(scale(kIconInset), scale(kIconInset + kFullTriangleSide)); |
| 392 triangle.rLineTo(scale(side), 0); | 392 triangle.rLineTo(scale(side), 0); |
| 393 triangle.rLineTo(0, -scale(side)); | 393 triangle.rLineTo(0, -scale(side)); |
| 394 triangle.close(); | 394 triangle.close(); |
| 395 return triangle; | 395 return triangle; |
| 396 }; | 396 }; |
| 397 | 397 |
| 398 cc::PaintFlags paint; | 398 cc::PaintFlags flags; |
| 399 paint.setAntiAlias(true); | 399 flags.setAntiAlias(true); |
| 400 paint.setStyle(cc::PaintFlags::kFill_Style); | 400 flags.setStyle(cc::PaintFlags::kFill_Style); |
| 401 // Background. Skip drawing for full signal. | 401 // Background. Skip drawing for full signal. |
| 402 if (signal_strength_ != kNumNetworkImages - 1) { | 402 if (signal_strength_ != kNumNetworkImages - 1) { |
| 403 paint.setColor(SkColorSetA(color_, kBgAlpha)); | 403 flags.setColor(SkColorSetA(color_, kBgAlpha)); |
| 404 canvas->DrawPath(make_triangle(kFullTriangleSide), paint); | 404 canvas->DrawPath(make_triangle(kFullTriangleSide), flags); |
| 405 } | 405 } |
| 406 // Foreground (signal strength). | 406 // Foreground (signal strength). |
| 407 if (signal_strength_ != 0) { | 407 if (signal_strength_ != 0) { |
| 408 paint.setColor(color_); | 408 flags.setColor(color_); |
| 409 // As a percentage of the bg triangle, the length of one of the short | 409 // As a percentage of the bg triangle, the length of one of the short |
| 410 // sides of the fg triangle, indexed by signal strength. | 410 // sides of the fg triangle, indexed by signal strength. |
| 411 static const float kTriangleSidePercents[] = {0.f, 0.5f, 0.625f, 0.75f, | 411 static const float kTriangleSidePercents[] = {0.f, 0.5f, 0.625f, 0.75f, |
| 412 1.f}; | 412 1.f}; |
| 413 canvas->DrawPath(make_triangle(kTriangleSidePercents[signal_strength_] * | 413 canvas->DrawPath(make_triangle(kTriangleSidePercents[signal_strength_] * |
| 414 kFullTriangleSide), | 414 kFullTriangleSide), |
| 415 paint); | 415 flags); |
| 416 } | 416 } |
| 417 } | 417 } |
| 418 | 418 |
| 419 ImageType image_type_; | 419 ImageType image_type_; |
| 420 IconType icon_type_; | 420 IconType icon_type_; |
| 421 SkColor color_; | 421 SkColor color_; |
| 422 | 422 |
| 423 // On a scale of 0 to kNum{Arcs,Bars}Images - 1, how connected we are. | 423 // On a scale of 0 to kNum{Arcs,Bars}Images - 1, how connected we are. |
| 424 int signal_strength_; | 424 int signal_strength_; |
| 425 | 425 |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 network_paths.insert((*iter)->path()); | 1090 network_paths.insert((*iter)->path()); |
| 1091 } | 1091 } |
| 1092 PurgeIconMap(ICON_TYPE_TRAY, network_paths); | 1092 PurgeIconMap(ICON_TYPE_TRAY, network_paths); |
| 1093 PurgeIconMap(ICON_TYPE_DEFAULT_VIEW, network_paths); | 1093 PurgeIconMap(ICON_TYPE_DEFAULT_VIEW, network_paths); |
| 1094 PurgeIconMap(ICON_TYPE_LIST, network_paths); | 1094 PurgeIconMap(ICON_TYPE_LIST, network_paths); |
| 1095 PurgeIconMap(ICON_TYPE_MENU_LIST, network_paths); | 1095 PurgeIconMap(ICON_TYPE_MENU_LIST, network_paths); |
| 1096 } | 1096 } |
| 1097 | 1097 |
| 1098 } // namespace network_icon | 1098 } // namespace network_icon |
| 1099 } // namespace ash | 1099 } // namespace ash |
| OLD | NEW |