OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 SERVICES_IMAGE_DECODER_PUBLIC_CPP_DECODE_H_ | 5 #ifndef SERVICES_IMAGE_DECODER_PUBLIC_CPP_DECODE_H_ |
6 #define SERVICES_IMAGE_DECODER_PUBLIC_CPP_DECODE_H_ | 6 #define SERVICES_IMAGE_DECODER_PUBLIC_CPP_DECODE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "services/image_decoder/public/interfaces/image_decoder.mojom.h" | 12 #include "services/image_decoder/public/interfaces/image_decoder.mojom.h" |
13 | 13 |
| 14 namespace gfx { |
| 15 class Size; |
| 16 } |
| 17 |
14 namespace service_manager { | 18 namespace service_manager { |
15 class Connector; | 19 class Connector; |
16 } | 20 } |
17 | 21 |
18 namespace image_decoder { | 22 namespace image_decoder { |
19 | 23 |
20 const uint64_t kDefaultMaxSizeInBytes = 128 * 1024 * 1024; | 24 const uint64_t kDefaultMaxSizeInBytes = 128 * 1024 * 1024; |
21 | 25 |
22 // Helper function to decode an image via the image_decoder service. Upon | 26 // Helper function to decode an image via the image_decoder service. For images |
23 // completion, |callback| is invoked on the calling thread TaskRunner with an | 27 // with multiple frames (e.g. ico files), a frame with a size as close as |
24 // SkBitmap argument. The SkBitmap will be null on failure and non-null on | 28 // possible to |desired_image_frame_size| is chosen (tries to take one in larger |
| 29 // size if there's no precise match). |
| 30 // Upon completion, |callback| is invoked on the calling thread TaskRunner with |
| 31 // an SkBitmap argument. The SkBitmap will be null on failure and non-null on |
25 // success. | 32 // success. |
26 void Decode(service_manager::Connector* connector, | 33 void Decode(service_manager::Connector* connector, |
27 const std::vector<uint8_t>& encoded_bytes, | 34 const std::vector<uint8_t>& encoded_bytes, |
28 mojom::ImageCodec codec, | 35 mojom::ImageCodec codec, |
29 bool shrink_to_fit, | 36 bool shrink_to_fit, |
30 uint64_t max_size_in_bytes, | 37 uint64_t max_size_in_bytes, |
| 38 const gfx::Size& desired_image_frame_size, |
31 const mojom::ImageDecoder::DecodeImageCallback& callback); | 39 const mojom::ImageDecoder::DecodeImageCallback& callback); |
32 | 40 |
33 } // namespace image_decoder | 41 } // namespace image_decoder |
34 | 42 |
35 #endif // SERVICES_IMAGE_DECODER_PUBLIC_CPP_DECODE_H_ | 43 #endif // SERVICES_IMAGE_DECODER_PUBLIC_CPP_DECODE_H_ |
OLD | NEW |