OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 BASE_GFX_JPEG_CODEC_H_ | 5 #ifndef APP_GFX_CODEC_JPEG_CODEC_H_ |
6 #define BASE_GFX_JPEG_CODEC_H_ | 6 #define APP_GFX_CODEC_JPEG_CODEC_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 class SkBitmap; | 10 class SkBitmap; |
11 | 11 |
| 12 namespace gfx { |
| 13 |
12 // Interface for encoding/decoding JPEG data. This is a wrapper around libjpeg, | 14 // Interface for encoding/decoding JPEG data. This is a wrapper around libjpeg, |
13 // which has an inconvenient interface for callers. This is only used for UI | 15 // which has an inconvenient interface for callers. This is only used for UI |
14 // elements, WebKit has its own more complicated JPEG decoder which handles, | 16 // elements, WebKit has its own more complicated JPEG decoder which handles, |
15 // among other things, partially downloaded data. | 17 // among other things, partially downloaded data. |
16 class JPEGCodec { | 18 class JPEGCodec { |
17 public: | 19 public: |
18 enum ColorFormat { | 20 enum ColorFormat { |
19 // 3 bytes per pixel (packed), in RGB order regardless of endianness. | 21 // 3 bytes per pixel (packed), in RGB order regardless of endianness. |
20 // This is the native JPEG format. | 22 // This is the native JPEG format. |
21 FORMAT_RGB, | 23 FORMAT_RGB, |
(...skipping 27 matching lines...) Expand all Loading... |
49 static bool Decode(const unsigned char* input, size_t input_size, | 51 static bool Decode(const unsigned char* input, size_t input_size, |
50 ColorFormat format, std::vector<unsigned char>* output, | 52 ColorFormat format, std::vector<unsigned char>* output, |
51 int* w, int* h); | 53 int* w, int* h); |
52 | 54 |
53 // Decodes the JPEG data contained in input of length input_size. If | 55 // Decodes the JPEG data contained in input of length input_size. If |
54 // successful, a SkBitmap is created and returned. It is up to the caller | 56 // successful, a SkBitmap is created and returned. It is up to the caller |
55 // to delete the returned bitmap. | 57 // to delete the returned bitmap. |
56 static SkBitmap* Decode(const unsigned char* input, size_t input_size); | 58 static SkBitmap* Decode(const unsigned char* input, size_t input_size); |
57 }; | 59 }; |
58 | 60 |
59 #endif // BASE_GFX_JPEG_CODEC_H_ | 61 } // namespace gfx |
| 62 |
| 63 #endif // APP_GFX_CODEC_JPEG_CODEC_H_ |
OLD | NEW |