webp-ffi 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +4 -1
- data/ext/webp_ffi/util.c +11 -8
- data/lib/webp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2369fa3ab99b3d494db9eeeb7f19c340c940d91d
|
4
|
+
data.tar.gz: 58ebaf382e3b9159ccb01f9d780b76a9be55d11f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: feb10c1edaaab6101c969dc8ea38324dae4e9a5268d71f994abb8dff878b1ce2c54553a19100bbf982d5b59ad99c6f692c974b3a5345fa03fae369dd067d4794
|
7
|
+
data.tar.gz: 002dda47a905f3f2e2dfd85b310eacd7771df366eeb663c0754ba10a9b54f3fb351768b46b8195799ea1b07da670c2a1a45a343030774bb80b80c9727410c5cc
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -116,13 +116,16 @@ Decode webp image (default format is png):
|
|
116
116
|
WebP.decode(filename, out_filename)
|
117
117
|
|
118
118
|
|
119
|
-
Decode webp image to pam, ppm or
|
119
|
+
Decode webp image to pam, ppm, pgm, bmp, tiff or yuv format of image:
|
120
120
|
|
121
121
|
filename = File.expand_path(File.join(File.dirname(__FILE__), "spec/factories/4.webp"))
|
122
122
|
out_filename = File.expand_path(File.join(File.dirname(__FILE__), "tmp/4.png"))
|
123
123
|
WebP.decode(filename, out_filename, output_format: :pam)
|
124
124
|
WebP.decode(filename, out_filename, output_format: :ppm)
|
125
125
|
WebP.decode(filename, out_filename, output_format: :pgm)
|
126
|
+
WebP.decode(filename, out_filename, output_format: :bmp)
|
127
|
+
WebP.decode(filename, out_filename, output_format: :tiff)
|
128
|
+
WebP.decode(filename, out_filename, output_format: :yuv)
|
126
129
|
|
127
130
|
|
128
131
|
Decode webp image with options:
|
data/ext/webp_ffi/util.c
CHANGED
@@ -137,7 +137,8 @@ static void PNGAPI error_function(png_structp png, png_const_charp dummy) {
|
|
137
137
|
|
138
138
|
static int UtilReadPNG(FILE* in_file, WebPPicture* const pic, int keep_alpha) {
|
139
139
|
png_structp png;
|
140
|
-
png_infop info;
|
140
|
+
png_infop info = NULL;
|
141
|
+
png_infop end_info = NULL;
|
141
142
|
int color_type, bit_depth, interlaced;
|
142
143
|
int has_alpha;
|
143
144
|
int num_passes;
|
@@ -155,13 +156,14 @@ static int UtilReadPNG(FILE* in_file, WebPPicture* const pic, int keep_alpha) {
|
|
155
156
|
png_set_error_fn(png, 0, error_function, NULL);
|
156
157
|
if (setjmp(png_jmpbuf(png))) {
|
157
158
|
Error:
|
158
|
-
png_destroy_read_struct(&png,
|
159
|
-
free(rgb);
|
159
|
+
png_destroy_read_struct(&png, &info, &end_info);
|
160
160
|
goto End;
|
161
161
|
}
|
162
162
|
|
163
163
|
info = png_create_info_struct(png);
|
164
164
|
if (info == NULL) goto Error;
|
165
|
+
end_info = png_create_info_struct(png);
|
166
|
+
if (end_info == NULL) goto Error;
|
165
167
|
|
166
168
|
png_init_io(png, in_file);
|
167
169
|
png_read_info(png, info);
|
@@ -202,20 +204,21 @@ static int UtilReadPNG(FILE* in_file, WebPPicture* const pic, int keep_alpha) {
|
|
202
204
|
png_read_rows(png, &row, NULL, 1);
|
203
205
|
}
|
204
206
|
}
|
205
|
-
png_read_end(png,
|
206
|
-
png_destroy_read_struct(&png, &info,
|
207
|
+
png_read_end(png, end_info);
|
208
|
+
png_destroy_read_struct(&png, &info, &end_info);
|
207
209
|
|
208
210
|
pic->width = width;
|
209
211
|
pic->height = height;
|
212
|
+
pic->use_argb = 1;
|
210
213
|
ok = has_alpha ? WebPPictureImportRGBA(pic, rgb, stride)
|
211
214
|
: WebPPictureImportRGB(pic, rgb, stride);
|
212
|
-
free(rgb);
|
213
215
|
|
214
|
-
if (ok
|
215
|
-
|
216
|
+
if (!ok) {
|
217
|
+
goto Error;
|
216
218
|
}
|
217
219
|
|
218
220
|
End:
|
221
|
+
free(rgb);
|
219
222
|
return ok;
|
220
223
|
}
|
221
224
|
|
data/lib/webp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webp-ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Vasyliev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|