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

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

Issue 23498059: Remove last dependencies on ui/base from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: last rebase Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/codec/jpeg_codec.h ('k') | ui/gfx/color_analysis.h » ('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_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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "ui/gfx/gfx_export.h" 12 #include "ui/gfx/gfx_export.h"
13 13
14 class SkBitmap; 14 class SkBitmap;
15 15
16 namespace gfx { 16 namespace gfx {
17 17
18 class Size; 18 class Size;
19 19
20 // Interface for encoding and decoding PNG data. This is a wrapper around 20 // Interface for encoding and decoding PNG data. This is a wrapper around
21 // libpng, which has an inconvenient interface for callers. This is currently 21 // libpng, which has an inconvenient interface for callers. This is currently
22 // designed for use in tests only (where we control the files), so the handling 22 // designed for use in tests only (where we control the files), so the handling
23 // isn't as robust as would be required for a browser (see Decode() for more). 23 // isn't as robust as would be required for a browser (see Decode() for more).
24 // WebKit has its own more complicated PNG decoder which handles, among other 24 // WebKit has its own more complicated PNG decoder which handles, among other
25 // things, partially downloaded data. 25 // things, partially downloaded data.
26 class UI_EXPORT PNGCodec { 26 class GFX_EXPORT PNGCodec {
27 public: 27 public:
28 enum ColorFormat { 28 enum ColorFormat {
29 // 3 bytes per pixel (packed), in RGB order regardless of endianness. 29 // 3 bytes per pixel (packed), in RGB order regardless of endianness.
30 // This is the native JPEG format. 30 // This is the native JPEG format.
31 FORMAT_RGB, 31 FORMAT_RGB,
32 32
33 // 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.
34 FORMAT_RGBA, 34 FORMAT_RGBA,
35 35
36 // 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.
37 // This is the default Windows DIB order. 37 // This is the default Windows DIB order.
38 FORMAT_BGRA, 38 FORMAT_BGRA,
39 39
40 // 4 bytes per pixel, in pre-multiplied kARGB_8888_Config format. For use 40 // 4 bytes per pixel, in pre-multiplied kARGB_8888_Config format. For use
41 // with directly writing to a skia bitmap. 41 // with directly writing to a skia bitmap.
42 FORMAT_SkBitmap 42 FORMAT_SkBitmap
43 }; 43 };
44 44
45 // Represents a comment in the tEXt ancillary chunk of the png. 45 // Represents a comment in the tEXt ancillary chunk of the png.
46 struct UI_EXPORT Comment { 46 struct GFX_EXPORT Comment {
47 Comment(const std::string& k, const std::string& t); 47 Comment(const std::string& k, const std::string& t);
48 ~Comment(); 48 ~Comment();
49 49
50 std::string key; 50 std::string key;
51 std::string text; 51 std::string text;
52 }; 52 };
53 53
54 // Encodes the given raw 'input' data, with each pixel being represented as 54 // Encodes the given raw 'input' data, with each pixel being represented as
55 // given in 'format'. The encoded PNG data will be written into the supplied 55 // given in 'format'. The encoded PNG data will be written into the supplied
56 // vector and true will be returned on success. On failure (false), the 56 // vector and true will be returned on success. On failure (false), the
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 static SkBitmap* CreateSkBitmapFromBGRAFormat( 119 static SkBitmap* CreateSkBitmapFromBGRAFormat(
120 const std::vector<unsigned char>& bgra, int width, int height); 120 const std::vector<unsigned char>& bgra, int width, int height);
121 121
122 private: 122 private:
123 DISALLOW_COPY_AND_ASSIGN(PNGCodec); 123 DISALLOW_COPY_AND_ASSIGN(PNGCodec);
124 }; 124 };
125 125
126 } // namespace gfx 126 } // namespace gfx
127 127
128 #endif // UI_GFX_CODEC_PNG_CODEC_H_ 128 #endif // UI_GFX_CODEC_PNG_CODEC_H_
OLDNEW
« no previous file with comments | « ui/gfx/codec/jpeg_codec.h ('k') | ui/gfx/color_analysis.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698