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

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

Issue 2944633002: Use SkPngEncoder in gfx jpeg_codec (Closed)
Patch Set: Nit Created 3 years, 5 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
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_PNG_CODEC_H_ 5 #ifndef UI_GFX_CODEC_PNG_CODEC_H_
6 #define UI_GFX_CODEC_PNG_CODEC_H_ 6 #define UI_GFX_CODEC_PNG_CODEC_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "ui/gfx/codec/codec_export.h" 14 #include "ui/gfx/codec/codec_export.h"
15 15
16 class SkBitmap; 16 class SkBitmap;
17 17
18 namespace gfx { 18 namespace gfx {
19 19
20 class Size; 20 class Size;
21 21
22 // Interface for encoding and decoding PNG data. This is a wrapper around 22 // Interface for encoding and decoding PNG data. This is a wrapper around
23 // libpng, which has an inconvenient interface for callers. This is currently 23 // libpng, which has an inconvenient interface for callers. This is currently
24 // designed for use in tests only (where we control the files), so the handling 24 // designed for use in tests only (where we control the files), so the handling
25 // isn't as robust as would be required for a browser (see Decode() for more). 25 // isn't as robust as would be required for a browser (see Decode() for more).
26 // WebKit has its own more complicated PNG decoder which handles, among other 26 // WebKit has its own more complicated PNG decoder which handles, among other
27 // things, partially downloaded data. 27 // things, partially downloaded data.
28 class CODEC_EXPORT PNGCodec { 28 class CODEC_EXPORT PNGCodec {
29 public: 29 public:
30 static constexpr int DEFAULT_ZLIB_COMPRESSION = 6;
31
30 enum ColorFormat { 32 enum ColorFormat {
31 // 4 bytes per pixel, in RGBA order in memory regardless of endianness. 33 // 4 bytes per pixel, in RGBA order in memory regardless of endianness.
32 FORMAT_RGBA, 34 FORMAT_RGBA,
33 35
34 // 4 bytes per pixel, in BGRA order in memory regardless of endianness. 36 // 4 bytes per pixel, in BGRA order in memory regardless of endianness.
35 // This is the default Windows DIB order. 37 // This is the default Windows DIB order.
36 FORMAT_BGRA, 38 FORMAT_BGRA,
37 39
38 // SkBitmap format. For Encode() kARGB_8888_Config (4 bytes per pixel) and 40 // SkBitmap format. For Encode() kARGB_8888_Config (4 bytes per pixel) and
39 // kA8_Config (1 byte per pixel) formats are supported. kA8_Config gets 41 // kA8_Config (1 byte per pixel) formats are supported. kA8_Config gets
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 static bool Decode(const unsigned char* input, size_t input_size, 123 static bool Decode(const unsigned char* input, size_t input_size,
122 SkBitmap* bitmap); 124 SkBitmap* bitmap);
123 125
124 private: 126 private:
125 DISALLOW_COPY_AND_ASSIGN(PNGCodec); 127 DISALLOW_COPY_AND_ASSIGN(PNGCodec);
126 }; 128 };
127 129
128 } // namespace gfx 130 } // namespace gfx
129 131
130 #endif // UI_GFX_CODEC_PNG_CODEC_H_ 132 #endif // UI_GFX_CODEC_PNG_CODEC_H_
OLDNEW
« no previous file with comments | « ui/gfx/codec/jpeg_codec.cc ('k') | ui/gfx/codec/png_codec.cc » ('j') | ui/gfx/codec/png_codec.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698