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 #ifndef COMPONENTS_FAVICON_BASE_FALLBACK_ICON_STYLE_H_ | 5 #ifndef COMPONENTS_FAVICON_BASE_FALLBACK_ICON_STYLE_H_ |
6 #define COMPONENTS_FAVICON_BASE_FALLBACK_ICON_STYLE_H_ | 6 #define COMPONENTS_FAVICON_BASE_FALLBACK_ICON_STYLE_H_ |
7 | 7 |
| 8 #include "base/memory/ref_counted_memory.h" |
8 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
9 | 10 |
10 namespace favicon_base { | 11 namespace favicon_base { |
11 | 12 |
12 // Styling specifications of a fallback icon. The icon is composed of a solid | 13 // Styling specifications of a fallback icon. The icon is composed of a solid |
13 // rounded square containing a single letter. The specification excludes the | 14 // rounded square containing a single letter. The specification excludes the |
14 // icon URL and size, which are given when the icon is rendered. | 15 // icon URL and size, which are given when the icon is rendered. |
15 struct FallbackIconStyle { | 16 struct FallbackIconStyle { |
16 FallbackIconStyle(); | 17 FallbackIconStyle(); |
17 ~FallbackIconStyle(); | 18 ~FallbackIconStyle(); |
(...skipping 12 matching lines...) Expand all Loading... |
30 // The roundness of the icon's corners. 0 => square icon, 1 => circle icon. | 31 // The roundness of the icon's corners. 0 => square icon, 1 => circle icon. |
31 double roundness; | 32 double roundness; |
32 }; | 33 }; |
33 | 34 |
34 // Reassigns |style|'s |text_color| to matches well against |background_color|. | 35 // Reassigns |style|'s |text_color| to matches well against |background_color|. |
35 void MatchFallbackIconTextColorAgainstBackgroundColor(FallbackIconStyle* style); | 36 void MatchFallbackIconTextColorAgainstBackgroundColor(FallbackIconStyle* style); |
36 | 37 |
37 // Returns whether |style| values are within bounds. | 38 // Returns whether |style| values are within bounds. |
38 bool ValidateFallbackIconStyle(const FallbackIconStyle& style); | 39 bool ValidateFallbackIconStyle(const FallbackIconStyle& style); |
39 | 40 |
| 41 // Set |style|'s background color to the dominant color of |bitmap_data|, |
| 42 // clamping luminance down to a reasonable maximum value so that light text is |
| 43 // readable. |
| 44 void SetDominantColorAsBackground( |
| 45 const scoped_refptr<base::RefCountedMemory>& bitmap_data, |
| 46 FallbackIconStyle* style); |
| 47 |
40 } // namespace favicon_base | 48 } // namespace favicon_base |
41 | 49 |
42 #endif // COMPONENTS_FAVICON_BASE_FALLBACK_ICON_STYLE_H_ | 50 #endif // COMPONENTS_FAVICON_BASE_FALLBACK_ICON_STYLE_H_ |
OLD | NEW |