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

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

Issue 1406613002: For some vector icons, get the size from the vector definition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/gfx/paint_vector_icon.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 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 VectorIconId::VECTOR_ICON_NONE); 387 VectorIconId::VECTOR_ICON_NONE);
388 } 388 }
389 389
390 ImageSkia CreateVectorIconWithBadge(VectorIconId id, 390 ImageSkia CreateVectorIconWithBadge(VectorIconId id,
391 size_t dip_size, 391 size_t dip_size,
392 SkColor color, 392 SkColor color,
393 VectorIconId badge_id) { 393 VectorIconId badge_id) {
394 return g_icon_cache.Get().GetOrCreateIcon(id, dip_size, color, badge_id); 394 return g_icon_cache.Get().GetOrCreateIcon(id, dip_size, color, badge_id);
395 } 395 }
396 396
397 ImageSkia CreatePrimaryVectorIcon(VectorIconId id, SkColor color) {
398 const PathElement* one_x_path = GetPathForVectorIconAt1xScale(id);
399 #ifndef NDEBUG
sky 2015/10/13 20:15:06 nit: if !defined(NDEBUG)
400 const PathElement* general_path = GetPathForVectorIcon(id);
401 DCHECK_NE(one_x_path, general_path);
402 #endif
403 DCHECK_EQ(one_x_path[0].type, CANVAS_DIMENSIONS);
404
405 const size_t size = one_x_path[1].arg;
406 return CreateVectorIcon(id, size, color);
407 }
408
397 ImageSkia CreateVectorIconFromSource(const std::string& source, 409 ImageSkia CreateVectorIconFromSource(const std::string& source,
398 size_t dip_size, 410 size_t dip_size,
399 SkColor color) { 411 SkColor color) {
400 return ImageSkia( 412 return ImageSkia(
401 new VectorIconSource(source, dip_size, color), 413 new VectorIconSource(source, dip_size, color),
402 gfx::Size(static_cast<int>(dip_size), static_cast<int>(dip_size))); 414 gfx::Size(static_cast<int>(dip_size), static_cast<int>(dip_size)));
403 } 415 }
404 416
405 } // namespace gfx 417 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/paint_vector_icon.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698