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

Side by Side Diff: ui/gfx/paint_vector_icon.cc

Issue 1464603003: Use std::tie() for operator< in ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/gfx/geometry/point_f.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 9
9 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
10 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_split.h" 12 #include "base/strings/string_split.h"
12 #include "third_party/skia/include/core/SkPaint.h" 13 #include "third_party/skia/include/core/SkPaint.h"
13 #include "third_party/skia/include/core/SkPath.h" 14 #include "third_party/skia/include/core/SkPath.h"
14 #include "third_party/skia/include/core/SkXfermode.h" 15 #include "third_party/skia/include/core/SkXfermode.h"
15 #include "ui/gfx/canvas.h" 16 #include "ui/gfx/canvas.h"
16 #include "ui/gfx/image/canvas_image_source.h" 17 #include "ui/gfx/image/canvas_image_source.h"
17 #include "ui/gfx/vector_icon_types.h" 18 #include "ui/gfx/vector_icon_types.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 340
340 private: 341 private:
341 struct IconDescription { 342 struct IconDescription {
342 IconDescription(VectorIconId id, 343 IconDescription(VectorIconId id,
343 size_t dip_size, 344 size_t dip_size,
344 SkColor color, 345 SkColor color,
345 VectorIconId badge_id) 346 VectorIconId badge_id)
346 : id(id), dip_size(dip_size), color(color), badge_id(badge_id) {} 347 : id(id), dip_size(dip_size), color(color), badge_id(badge_id) {}
347 348
348 bool operator<(const IconDescription& other) const { 349 bool operator<(const IconDescription& other) const {
349 if (id != other.id) 350 return std::tie(id, dip_size, color, badge_id) <
350 return id < other.id; 351 std::tie(other.id, other.dip_size, other.color, other.badge_id);
351 if (dip_size != other.dip_size)
352 return dip_size < other.dip_size;
353 if (color != other.color)
354 return color < other.color;
355 return badge_id < other.badge_id;
356 } 352 }
357 353
358 VectorIconId id; 354 VectorIconId id;
359 size_t dip_size; 355 size_t dip_size;
360 SkColor color; 356 SkColor color;
361 VectorIconId badge_id; 357 VectorIconId badge_id;
362 }; 358 };
363 359
364 std::map<IconDescription, ImageSkia> images_; 360 std::map<IconDescription, ImageSkia> images_;
365 361
(...skipping 30 matching lines...) Expand all
396 392
397 ImageSkia CreateVectorIconFromSource(const std::string& source, 393 ImageSkia CreateVectorIconFromSource(const std::string& source,
398 size_t dip_size, 394 size_t dip_size,
399 SkColor color) { 395 SkColor color) {
400 return ImageSkia( 396 return ImageSkia(
401 new VectorIconSource(source, dip_size, color), 397 new VectorIconSource(source, dip_size, color),
402 gfx::Size(static_cast<int>(dip_size), static_cast<int>(dip_size))); 398 gfx::Size(static_cast<int>(dip_size), static_cast<int>(dip_size)));
403 } 399 }
404 400
405 } // namespace gfx 401 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/geometry/point_f.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698