OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 UI_GFX_CODEC_JPEG_CODEC_H_ | 5 #ifndef UI_GFX_CODEC_JPEG_CODEC_H_ |
6 #define UI_GFX_CODEC_JPEG_CODEC_H_ | 6 #define UI_GFX_CODEC_JPEG_CODEC_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
| 12 #include "ui/ui_api.h" |
| 13 |
12 class SkBitmap; | 14 class SkBitmap; |
13 | 15 |
14 namespace gfx { | 16 namespace gfx { |
15 | 17 |
16 // Interface for encoding/decoding JPEG data. This is a wrapper around libjpeg, | 18 // Interface for encoding/decoding JPEG data. This is a wrapper around libjpeg, |
17 // which has an inconvenient interface for callers. This is only used for UI | 19 // which has an inconvenient interface for callers. This is only used for UI |
18 // elements, WebKit has its own more complicated JPEG decoder which handles, | 20 // elements, WebKit has its own more complicated JPEG decoder which handles, |
19 // among other things, partially downloaded data. | 21 // among other things, partially downloaded data. |
20 class JPEGCodec { | 22 class UI_API JPEGCodec { |
21 public: | 23 public: |
22 enum ColorFormat { | 24 enum ColorFormat { |
23 // 3 bytes per pixel (packed), in RGB order regardless of endianness. | 25 // 3 bytes per pixel (packed), in RGB order regardless of endianness. |
24 // This is the native JPEG format. | 26 // This is the native JPEG format. |
25 FORMAT_RGB, | 27 FORMAT_RGB, |
26 | 28 |
27 // 4 bytes per pixel, in RGBA order in mem regardless of endianness. | 29 // 4 bytes per pixel, in RGBA order in mem regardless of endianness. |
28 FORMAT_RGBA, | 30 FORMAT_RGBA, |
29 | 31 |
30 // 4 bytes per pixel, in BGRA order in mem regardless of endianness. | 32 // 4 bytes per pixel, in BGRA order in mem regardless of endianness. |
(...skipping 29 matching lines...) Expand all Loading... |
60 | 62 |
61 // Decodes the JPEG data contained in input of length input_size. If | 63 // Decodes the JPEG data contained in input of length input_size. If |
62 // successful, a SkBitmap is created and returned. It is up to the caller | 64 // successful, a SkBitmap is created and returned. It is up to the caller |
63 // to delete the returned bitmap. | 65 // to delete the returned bitmap. |
64 static SkBitmap* Decode(const unsigned char* input, size_t input_size); | 66 static SkBitmap* Decode(const unsigned char* input, size_t input_size); |
65 }; | 67 }; |
66 | 68 |
67 } // namespace gfx | 69 } // namespace gfx |
68 | 70 |
69 #endif // UI_GFX_CODEC_JPEG_CODEC_H_ | 71 #endif // UI_GFX_CODEC_JPEG_CODEC_H_ |
OLD | NEW |