Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: ui/gfx/codec/jpeg_codec.h

Issue 2920263002: Delete FORMAT_RGB and legacy libjpeg support from gfx::JpegCodec (Closed)
Patch Set: Fix PFQ chrome build Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/gpu/jpeg_decode_accelerator_unittest.cc ('k') | ui/gfx/codec/jpeg_codec.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/codec/codec_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 CODEC_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.
27 // This is the native JPEG format.
28 FORMAT_RGB,
29
30 // 4 bytes per pixel, in RGBA order in mem regardless of endianness. 26 // 4 bytes per pixel, in RGBA order in mem regardless of endianness.
31 FORMAT_RGBA, 27 FORMAT_RGBA,
32 28
33 // 4 bytes per pixel, in BGRA order in mem regardless of endianness. 29 // 4 bytes per pixel, in BGRA order in mem regardless of endianness.
34 // This is the default Windows DIB order. 30 // This is the default Windows DIB order.
35 FORMAT_BGRA, 31 FORMAT_BGRA,
36 32
37 // 4 bytes per pixel, it can be either RGBA or BGRA. It depends on the bit 33 // 4 bytes per pixel, it can be either RGBA or BGRA. It depends on the bit
38 // order in kARGB_8888_Config skia bitmap. 34 // order in kARGB_8888_Config skia bitmap.
39 FORMAT_SkBitmap 35 FORMAT_SkBitmap
40 }; 36 };
41 37
42 enum LibraryVariant {
43 SYSTEM_LIBJPEG = 0,
44 LIBJPEG_TURBO,
45 IJG_LIBJPEG,
46 };
47
48 // This method helps identify at run time which library chromium is using.
49 static LibraryVariant JpegLibraryVariant();
50
51 // Encodes the given raw 'input' data, with each pixel being represented as 38 // Encodes the given raw 'input' data, with each pixel being represented as
52 // given in 'format'. The encoded JPEG data will be written into the supplied 39 // given in 'format'. The encoded JPEG data will be written into the supplied
53 // vector and true will be returned on success. On failure (false), the 40 // vector and true will be returned on success. On failure (false), the
54 // contents of the output buffer are undefined. 41 // contents of the output buffer are undefined.
55 // 42 //
56 // w, h: dimensions of the image 43 // w, h: dimensions of the image
57 // row_byte_width: the width in bytes of each row. This may be greater than 44 // row_byte_width: the width in bytes of each row. This may be greater than
58 // w * bytes_per_pixel if there is extra padding at the end of each row 45 // w * bytes_per_pixel if there is extra padding at the end of each row
59 // (often, each row is padded to the next machine word). 46 // (often, each row is padded to the next machine word).
60 // quality: an integer in the range 0-100, where 100 is the highest quality. 47 // quality: an integer in the range 0-100, where 100 is the highest quality.
(...skipping 11 matching lines...) Expand all
72 59
73 // Decodes the JPEG data contained in input of length input_size. If 60 // Decodes the JPEG data contained in input of length input_size. If
74 // successful, a SkBitmap is created and returned. 61 // successful, a SkBitmap is created and returned.
75 static std::unique_ptr<SkBitmap> Decode(const unsigned char* input, 62 static std::unique_ptr<SkBitmap> Decode(const unsigned char* input,
76 size_t input_size); 63 size_t input_size);
77 }; 64 };
78 65
79 } // namespace gfx 66 } // namespace gfx
80 67
81 #endif // UI_GFX_CODEC_JPEG_CODEC_H_ 68 #endif // UI_GFX_CODEC_JPEG_CODEC_H_
OLDNEW
« no previous file with comments | « media/gpu/jpeg_decode_accelerator_unittest.cc ('k') | ui/gfx/codec/jpeg_codec.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698