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 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "ui/gfx/gfx_export.h" | 13 #include "ui/gfx/codec/codec_export.h" |
14 | 14 |
15 class SkBitmap; | 15 class SkBitmap; |
16 | 16 |
17 namespace gfx { | 17 namespace gfx { |
18 | 18 |
19 // Interface for encoding/decoding JPEG data. This is a wrapper around libjpeg, | 19 // Interface for encoding/decoding JPEG data. This is a wrapper around libjpeg, |
20 // which has an inconvenient interface for callers. This is only used for UI | 20 // which has an inconvenient interface for callers. This is only used for UI |
21 // elements, WebKit has its own more complicated JPEG decoder which handles, | 21 // elements, WebKit has its own more complicated JPEG decoder which handles, |
22 // among other things, partially downloaded data. | 22 // among other things, partially downloaded data. |
23 class GFX_EXPORT JPEGCodec { | 23 class CODEC_EXPORT JPEGCodec { |
24 public: | 24 public: |
25 enum ColorFormat { | 25 enum ColorFormat { |
26 // 3 bytes per pixel (packed), in RGB order regardless of endianness. | 26 // 3 bytes per pixel (packed), in RGB order regardless of endianness. |
27 // This is the native JPEG format. | 27 // This is the native JPEG format. |
28 FORMAT_RGB, | 28 FORMAT_RGB, |
29 | 29 |
30 // 4 bytes per pixel, in RGBA order in mem regardless of endianness. | 30 // 4 bytes per pixel, in RGBA order in mem regardless of endianness. |
31 FORMAT_RGBA, | 31 FORMAT_RGBA, |
32 | 32 |
33 // 4 bytes per pixel, in BGRA order in mem regardless of endianness. | 33 // 4 bytes per pixel, in BGRA order in mem regardless of endianness. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 // Decodes the JPEG data contained in input of length input_size. If | 73 // Decodes the JPEG data contained in input of length input_size. If |
74 // successful, a SkBitmap is created and returned. | 74 // successful, a SkBitmap is created and returned. |
75 static std::unique_ptr<SkBitmap> Decode(const unsigned char* input, | 75 static std::unique_ptr<SkBitmap> Decode(const unsigned char* input, |
76 size_t input_size); | 76 size_t input_size); |
77 }; | 77 }; |
78 | 78 |
79 } // namespace gfx | 79 } // namespace gfx |
80 | 80 |
81 #endif // UI_GFX_CODEC_JPEG_CODEC_H_ | 81 #endif // UI_GFX_CODEC_JPEG_CODEC_H_ |
OLD | NEW |