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

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

Issue 1874403003: Tweak libpng encoding parameters to increase speed on very large images. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweaks and improve perf tests. Created 4 years, 8 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>
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 bool discard_transparency, 89 bool discard_transparency,
90 std::vector<unsigned char>* output); 90 std::vector<unsigned char>* output);
91 91
92 // Call PNGCodec::Encode on the supplied SkBitmap |input|. The difference 92 // Call PNGCodec::Encode on the supplied SkBitmap |input|. The difference
93 // between this and the previous method is that this restricts compression to 93 // between this and the previous method is that this restricts compression to
94 // zlib q1, which is just rle encoding. 94 // zlib q1, which is just rle encoding.
95 static bool FastEncodeBGRASkBitmap(const SkBitmap& input, 95 static bool FastEncodeBGRASkBitmap(const SkBitmap& input,
96 bool discard_transparency, 96 bool discard_transparency,
97 std::vector<unsigned char>* output); 97 std::vector<unsigned char>* output);
98 98
99 // Similar to FastEncodeBGRASkBitmap, but with no compression at all.
100 static bool NoCompressEncodeBGRASkBitmap(const SkBitmap& input,
101 bool discard_transparency,
102 std::vector<unsigned char>* output);
103
99 // Call PNGCodec::Encode on the supplied SkBitmap |input|, which is assumed 104 // Call PNGCodec::Encode on the supplied SkBitmap |input|, which is assumed
100 // to be kA8_Config, 8 bits per pixel. The bitmap is encoded as a grayscale 105 // to be kA8_Config, 8 bits per pixel. The bitmap is encoded as a grayscale
101 // PNG with alpha used for color intensity. The |output| param is passed 106 // PNG with alpha used for color intensity. The |output| param is passed
102 // directly to Encode; refer to Encode for more information. During the call, 107 // directly to Encode; refer to Encode for more information. During the call,
103 // an SkAutoLockPixels lock is held on |input|. 108 // an SkAutoLockPixels lock is held on |input|.
104 static bool EncodeA8SkBitmap(const SkBitmap& input, 109 static bool EncodeA8SkBitmap(const SkBitmap& input,
105 std::vector<unsigned char>* output); 110 std::vector<unsigned char>* output);
106 111
107 // Decodes the PNG data contained in input of length input_size. The 112 // Decodes the PNG data contained in input of length input_size. The
108 // decoded data will be placed in *output with the dimensions in *w and *h 113 // decoded data will be placed in *output with the dimensions in *w and *h
(...skipping 18 matching lines...) Expand all
127 static bool Decode(const unsigned char* input, size_t input_size, 132 static bool Decode(const unsigned char* input, size_t input_size,
128 SkBitmap* bitmap); 133 SkBitmap* bitmap);
129 134
130 private: 135 private:
131 DISALLOW_COPY_AND_ASSIGN(PNGCodec); 136 DISALLOW_COPY_AND_ASSIGN(PNGCodec);
132 }; 137 };
133 138
134 } // namespace gfx 139 } // namespace gfx
135 140
136 #endif // UI_GFX_CODEC_PNG_CODEC_H_ 141 #endif // UI_GFX_CODEC_PNG_CODEC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698