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