| 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 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 // 4 bytes per pixel, in BGRA order in mem regardless of endianness. | 31 // 4 bytes per pixel, in BGRA order in mem regardless of endianness. |
| 32 // This is the default Windows DIB order. | 32 // This is the default Windows DIB order. |
| 33 FORMAT_BGRA, | 33 FORMAT_BGRA, |
| 34 | 34 |
| 35 // 4 bytes per pixel, it can be either RGBA or BGRA. It depends on the bit | 35 // 4 bytes per pixel, it can be either RGBA or BGRA. It depends on the bit |
| 36 // order in kARGB_8888_Config skia bitmap. | 36 // order in kARGB_8888_Config skia bitmap. |
| 37 FORMAT_SkBitmap | 37 FORMAT_SkBitmap |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 enum LibraryVariant { |
| 41 SYSTEM_LIBJPEG = 0, |
| 42 LIBJPEG_TURBO, |
| 43 IJG_LIBJPEG, |
| 44 }; |
| 45 |
| 46 // This method helps identify at run time which library chromium is using. |
| 47 static LibraryVariant JpegLibraryVariant(); |
| 48 |
| 40 // Encodes the given raw 'input' data, with each pixel being represented as | 49 // Encodes the given raw 'input' data, with each pixel being represented as |
| 41 // given in 'format'. The encoded JPEG data will be written into the supplied | 50 // given in 'format'. The encoded JPEG data will be written into the supplied |
| 42 // vector and true will be returned on success. On failure (false), the | 51 // vector and true will be returned on success. On failure (false), the |
| 43 // contents of the output buffer are undefined. | 52 // contents of the output buffer are undefined. |
| 44 // | 53 // |
| 45 // w, h: dimensions of the image | 54 // w, h: dimensions of the image |
| 46 // row_byte_width: the width in bytes of each row. This may be greater than | 55 // row_byte_width: the width in bytes of each row. This may be greater than |
| 47 // w * bytes_per_pixel if there is extra padding at the end of each row | 56 // w * bytes_per_pixel if there is extra padding at the end of each row |
| 48 // (often, each row is padded to the next machine word). | 57 // (often, each row is padded to the next machine word). |
| 49 // quality: an integer in the range 0-100, where 100 is the highest quality. | 58 // quality: an integer in the range 0-100, where 100 is the highest quality. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 61 | 70 |
| 62 // Decodes the JPEG data contained in input of length input_size. If | 71 // Decodes the JPEG data contained in input of length input_size. If |
| 63 // successful, a SkBitmap is created and returned. It is up to the caller | 72 // successful, a SkBitmap is created and returned. It is up to the caller |
| 64 // to delete the returned bitmap. | 73 // to delete the returned bitmap. |
| 65 static SkBitmap* Decode(const unsigned char* input, size_t input_size); | 74 static SkBitmap* Decode(const unsigned char* input, size_t input_size); |
| 66 }; | 75 }; |
| 67 | 76 |
| 68 } // namespace gfx | 77 } // namespace gfx |
| 69 | 78 |
| 70 #endif // UI_GFX_CODEC_JPEG_CODEC_H_ | 79 #endif // UI_GFX_CODEC_JPEG_CODEC_H_ |
| OLD | NEW |