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

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

Issue 7328011: Introduce ui.dll / libui.so for the component build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "ui/ui_api.h"
13 14
14 class SkBitmap; 15 class SkBitmap;
15 16
16 namespace gfx { 17 namespace gfx {
17 18
18 class Size; 19 class Size;
19 20
20 // Interface for encoding and decoding PNG data. This is a wrapper around 21 // Interface for encoding and decoding PNG data. This is a wrapper around
21 // libpng, which has an inconvenient interface for callers. This is currently 22 // 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 23 // 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). 24 // 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 25 // WebKit has its own more complicated PNG decoder which handles, among other
25 // things, partially downloaded data. 26 // things, partially downloaded data.
26 class PNGCodec { 27 class UI_API PNGCodec {
27 public: 28 public:
28 enum ColorFormat { 29 enum ColorFormat {
29 // 3 bytes per pixel (packed), in RGB order regardless of endianness. 30 // 3 bytes per pixel (packed), in RGB order regardless of endianness.
30 // This is the native JPEG format. 31 // This is the native JPEG format.
31 FORMAT_RGB, 32 FORMAT_RGB,
32 33
33 // 4 bytes per pixel, in RGBA order in memory regardless of endianness. 34 // 4 bytes per pixel, in RGBA order in memory regardless of endianness.
34 FORMAT_RGBA, 35 FORMAT_RGBA,
35 36
36 // 4 bytes per pixel, in BGRA order in memory regardless of endianness. 37 // 4 bytes per pixel, in BGRA order in memory regardless of endianness.
37 // This is the default Windows DIB order. 38 // This is the default Windows DIB order.
38 FORMAT_BGRA, 39 FORMAT_BGRA,
39 40
40 // 4 bytes per pixel, in pre-multiplied kARGB_8888_Config format. For use 41 // 4 bytes per pixel, in pre-multiplied kARGB_8888_Config format. For use
41 // with directly writing to a skia bitmap. 42 // with directly writing to a skia bitmap.
42 FORMAT_SkBitmap 43 FORMAT_SkBitmap
43 }; 44 };
44 45
45 // Represents a comment in the tEXt ancillary chunk of the png. 46 // Represents a comment in the tEXt ancillary chunk of the png.
46 struct Comment { 47 struct UI_API Comment {
47 Comment(const std::string& k, const std::string& t); 48 Comment(const std::string& k, const std::string& t);
48 ~Comment(); 49 ~Comment();
49 50
50 std::string key; 51 std::string key;
51 std::string text; 52 std::string text;
52 }; 53 };
53 54
54 // Calls PNGCodec::EncodeWithCompressionLevel with the default compression 55 // Calls PNGCodec::EncodeWithCompressionLevel with the default compression
55 // level. 56 // level.
56 static bool Encode(const unsigned char* input, 57 static bool Encode(const unsigned char* input,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 static SkBitmap* CreateSkBitmapFromBGRAFormat( 126 static SkBitmap* CreateSkBitmapFromBGRAFormat(
126 std::vector<unsigned char>& bgra, int width, int height); 127 std::vector<unsigned char>& bgra, int width, int height);
127 128
128 private: 129 private:
129 DISALLOW_COPY_AND_ASSIGN(PNGCodec); 130 DISALLOW_COPY_AND_ASSIGN(PNGCodec);
130 }; 131 };
131 132
132 } // namespace gfx 133 } // namespace gfx
133 134
134 #endif // UI_GFX_CODEC_PNG_CODEC_H_ 135 #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') | ui/ui.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698