| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/common/image_util.h" | 5 #include "extensions/common/image_util.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "third_party/re2/re2/re2.h" | 13 #include "third_party/re2/src/re2/re2.h" |
| 14 #include "third_party/skia/include/core/SkColor.h" | 14 #include "third_party/skia/include/core/SkColor.h" |
| 15 #include "ui/gfx/color_utils.h" | 15 #include "ui/gfx/color_utils.h" |
| 16 | 16 |
| 17 namespace extensions { | 17 namespace extensions { |
| 18 namespace image_util { | 18 namespace image_util { |
| 19 | 19 |
| 20 bool ParseCssColorString(const std::string& color_string, SkColor* result) { | 20 bool ParseCssColorString(const std::string& color_string, SkColor* result) { |
| 21 if (color_string.empty()) | 21 if (color_string.empty()) |
| 22 return false; | 22 return false; |
| 23 if (color_string[0] == '#') | 23 if (color_string[0] == '#') |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 hsl.l = std::max(0.0, std::min(100.0, lightness)) / 100.0; | 93 hsl.l = std::max(0.0, std::min(100.0, lightness)) / 100.0; |
| 94 | 94 |
| 95 SkAlpha sk_alpha = std::max(0.0, std::min(1.0, alpha)) * 255; | 95 SkAlpha sk_alpha = std::max(0.0, std::min(1.0, alpha)) * 255; |
| 96 | 96 |
| 97 *result = color_utils::HSLToSkColor(hsl, sk_alpha); | 97 *result = color_utils::HSLToSkColor(hsl, sk_alpha); |
| 98 return true; | 98 return true; |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace image_util | 101 } // namespace image_util |
| 102 } // namespace extensions | 102 } // namespace extensions |
| OLD | NEW |