| 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 #ifndef COMPONENTS_FAVICON_BASE_FAVICON_UTIL_H_ | 5 #ifndef COMPONENTS_FAVICON_BASE_FAVICON_UTIL_H_ |
| 6 #define COMPONENTS_FAVICON_BASE_FAVICON_UTIL_H_ | 6 #define COMPONENTS_FAVICON_BASE_FAVICON_UTIL_H_ |
| 7 | 7 |
| 8 #include <map> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "components/favicon_base/favicon_types.h" | 11 #include "components/favicon_base/favicon_types.h" |
| 11 | 12 |
| 12 namespace gfx { | 13 namespace gfx { |
| 13 class Image; | 14 class Image; |
| 14 } | 15 } |
| 15 | 16 |
| 16 namespace favicon_base { | 17 namespace favicon_base { |
| 17 | 18 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 29 void SetFaviconColorSpace(gfx::Image* image); | 30 void SetFaviconColorSpace(gfx::Image* image); |
| 30 | 31 |
| 31 // Takes a vector of PNG-encoded frames, and converts it to a gfx::Image of | 32 // Takes a vector of PNG-encoded frames, and converts it to a gfx::Image of |
| 32 // size |favicon_size| in DIPS. The result gfx::Image has a gfx::ImageSkia with | 33 // size |favicon_size| in DIPS. The result gfx::Image has a gfx::ImageSkia with |
| 33 // gfx::ImageSkiaReps for each |favicon_scales|. | 34 // gfx::ImageSkiaReps for each |favicon_scales|. |
| 34 gfx::Image SelectFaviconFramesFromPNGs( | 35 gfx::Image SelectFaviconFramesFromPNGs( |
| 35 const std::vector<favicon_base::FaviconRawBitmapResult>& png_data, | 36 const std::vector<favicon_base::FaviconRawBitmapResult>& png_data, |
| 36 const std::vector<float>& favicon_scales, | 37 const std::vector<float>& favicon_scales, |
| 37 int favicon_size); | 38 int favicon_size); |
| 38 | 39 |
| 40 gfx::Image SelectFaviconFramesForPixelSizesFromPNGs( |
| 41 const std::vector<favicon_base::FaviconRawBitmapResult>& png_data, |
| 42 const std::map<int, float>& desired_pixel_sizes); |
| 43 |
| 39 // Generates a favicon_bitmap_result sized exactly to [desired_size, | 44 // Generates a favicon_bitmap_result sized exactly to [desired_size, |
| 40 // desired_size] from the provided result set. If the exact size is found in | 45 // desired_size] from the provided result set. If the exact size is found in |
| 41 // the set, it just returns that; otherwise, it will decode the PNG, scale, | 46 // the set, it just returns that; otherwise, it will decode the PNG, scale, |
| 42 // and encode a new PNG. | 47 // and encode a new PNG. |
| 43 favicon_base::FaviconRawBitmapResult ResizeFaviconBitmapResult( | 48 favicon_base::FaviconRawBitmapResult ResizeFaviconBitmapResult( |
| 44 const std::vector<favicon_base::FaviconRawBitmapResult>& | 49 const std::vector<favicon_base::FaviconRawBitmapResult>& |
| 45 favicon_bitmap_results, | 50 favicon_bitmap_results, |
| 46 int desired_size_in_pixel); | 51 int desired_size_in_pixel); |
| 47 | 52 |
| 48 } // namspace favicon_base | 53 } // namspace favicon_base |
| 49 | 54 |
| 50 #endif // COMPONENTS_FAVICON_BASE_FAVICON_UTIL_H_ | 55 #endif // COMPONENTS_FAVICON_BASE_FAVICON_UTIL_H_ |
| OLD | NEW |