vector_icon_utils.cc 810 B

1234567891011121314151617181920212223242526
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ui/gfx/vector_icon_utils.h"
  5. #include <ostream>
  6. #include "base/check_op.h"
  7. #include "ui/gfx/vector_icon_types.h"
  8. namespace gfx {
  9. int GetDefaultSizeOfVectorIcon(const VectorIcon& icon) {
  10. if (icon.is_empty())
  11. return -1;
  12. const PathElement* default_icon_path = icon.reps[icon.reps_size - 1].path;
  13. DCHECK_EQ(default_icon_path[0].command, CANVAS_DIMENSIONS)
  14. << " " << icon.name
  15. << " has no size in its icon definition, and it seems unlikely you want "
  16. "to display at the default of 48dip. Please specify a size in "
  17. "CreateVectorIcon().";
  18. return default_icon_path[1].arg;
  19. }
  20. } // namespace gfx