| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/gfx/paint_vector_icon.h" | 5 #include "ui/gfx/paint_vector_icon.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <tuple> | 8 #include <tuple> |
| 9 | 9 |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 int dip_size; | 473 int dip_size; |
| 474 SkColor color; | 474 SkColor color; |
| 475 const gfx::VectorIcon* badge_icon; | 475 const gfx::VectorIcon* badge_icon; |
| 476 }; | 476 }; |
| 477 | 477 |
| 478 std::map<IconDescription, ImageSkia> images_; | 478 std::map<IconDescription, ImageSkia> images_; |
| 479 | 479 |
| 480 DISALLOW_COPY_AND_ASSIGN(VectorIconCache); | 480 DISALLOW_COPY_AND_ASSIGN(VectorIconCache); |
| 481 }; | 481 }; |
| 482 | 482 |
| 483 static base::LazyInstance<VectorIconCache> g_icon_cache = | 483 static base::LazyInstance<VectorIconCache>::DestructorAtExit g_icon_cache = |
| 484 LAZY_INSTANCE_INITIALIZER; | 484 LAZY_INSTANCE_INITIALIZER; |
| 485 | 485 |
| 486 class VectorIconCacheLegacy { | 486 class VectorIconCacheLegacy { |
| 487 public: | 487 public: |
| 488 VectorIconCacheLegacy() {} | 488 VectorIconCacheLegacy() {} |
| 489 ~VectorIconCacheLegacy() {} | 489 ~VectorIconCacheLegacy() {} |
| 490 | 490 |
| 491 ImageSkia GetOrCreateIcon(VectorIconId id, | 491 ImageSkia GetOrCreateIcon(VectorIconId id, |
| 492 int dip_size, | 492 int dip_size, |
| 493 SkColor color, | 493 SkColor color, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 520 int dip_size; | 520 int dip_size; |
| 521 SkColor color; | 521 SkColor color; |
| 522 VectorIconId badge_id; | 522 VectorIconId badge_id; |
| 523 }; | 523 }; |
| 524 | 524 |
| 525 std::map<IconDescription, ImageSkia> images_; | 525 std::map<IconDescription, ImageSkia> images_; |
| 526 | 526 |
| 527 DISALLOW_COPY_AND_ASSIGN(VectorIconCacheLegacy); | 527 DISALLOW_COPY_AND_ASSIGN(VectorIconCacheLegacy); |
| 528 }; | 528 }; |
| 529 | 529 |
| 530 static base::LazyInstance<VectorIconCacheLegacy> g_icon_cache_legacy = | 530 static base::LazyInstance<VectorIconCacheLegacy>::DestructorAtExit |
| 531 LAZY_INSTANCE_INITIALIZER; | 531 g_icon_cache_legacy = LAZY_INSTANCE_INITIALIZER; |
| 532 | 532 |
| 533 } // namespace | 533 } // namespace |
| 534 | 534 |
| 535 const VectorIcon kNoneIcon = {}; | 535 const VectorIcon kNoneIcon = {}; |
| 536 | 536 |
| 537 void PaintVectorIcon(Canvas* canvas, | 537 void PaintVectorIcon(Canvas* canvas, |
| 538 VectorIconId id, | 538 VectorIconId id, |
| 539 int dip_size, | 539 int dip_size, |
| 540 SkColor color) { | 540 SkColor color) { |
| 541 DCHECK(VectorIconId::VECTOR_ICON_NONE != id); | 541 DCHECK(VectorIconId::VECTOR_ICON_NONE != id); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 } | 602 } |
| 603 | 603 |
| 604 ImageSkia CreateVectorIconFromSource(const std::string& source, | 604 ImageSkia CreateVectorIconFromSource(const std::string& source, |
| 605 int dip_size, | 605 int dip_size, |
| 606 SkColor color) { | 606 SkColor color) { |
| 607 return CanvasImageSource::MakeImageSkia<VectorIconSourceLegacy>( | 607 return CanvasImageSource::MakeImageSkia<VectorIconSourceLegacy>( |
| 608 source, dip_size, color); | 608 source, dip_size, color); |
| 609 } | 609 } |
| 610 | 610 |
| 611 } // namespace gfx | 611 } // namespace gfx |
| OLD | NEW |