OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "sk_canvas.h" | 8 #include "sk_canvas.h" |
9 #include "sk_data.h" | 9 #include "sk_data.h" |
10 #include "sk_image.h" | 10 #include "sk_image.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 SkImageInfo info; | 226 SkImageInfo info; |
227 if (!from_c_info(*cinfo, &info)) { | 227 if (!from_c_info(*cinfo, &info)) { |
228 return NULL; | 228 return NULL; |
229 } | 229 } |
230 return (sk_image_t*)SkImage::NewRasterCopy(info, pixels, rowBytes); | 230 return (sk_image_t*)SkImage::NewRasterCopy(info, pixels, rowBytes); |
231 } | 231 } |
232 | 232 |
233 #include "SkDecodingImageGenerator.h" | 233 #include "SkDecodingImageGenerator.h" |
234 | 234 |
235 sk_image_t* sk_image_new_from_data(const sk_data_t* cdata) { | 235 sk_image_t* sk_image_new_from_data(const sk_data_t* cdata) { |
236 SkImageGenerator* gen = SkDecodingImageGenerator::Create(AsData(cdata), | 236 SkImageGenerator* gen = NULL; |
237 SkDecodingImageGene rator::Options()); | 237 #if 0 |
scroggo
2014/12/30 11:14:33
Can we use a macro here to only behave this way if
reed1
2015/01/05 16:04:59
The #if 0 is meant to be (very) temporary, as I ho
| |
238 // enable this when SkDecodingImageGenerator is available in chrome (decode codecs) | |
239 gen = SkDecodingImageGenerator::Create(AsData(cdata), SkDecodingImageGenerat or::Options()); | |
240 #endif | |
238 if (NULL == gen) { | 241 if (NULL == gen) { |
239 return NULL; | 242 return NULL; |
240 } | 243 } |
241 return ToImage(SkImage::NewFromGenerator(gen)); | 244 return ToImage(SkImage::NewFromGenerator(gen)); |
242 } | 245 } |
243 | 246 |
244 sk_data_t* sk_image_encode(const sk_image_t* cimage) { | 247 sk_data_t* sk_image_encode(const sk_image_t* cimage) { |
245 return ToData(AsImage(cimage)->encode()); | 248 return ToData(AsImage(cimage)->encode()); |
246 } | 249 } |
247 | 250 |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
687 sk_image_t* cimage = sk_surface_new_image_snapshot(csurface); | 690 sk_image_t* cimage = sk_surface_new_image_snapshot(csurface); |
688 | 691 |
689 // HERE WE CROSS THE C..C++ boundary | 692 // HERE WE CROSS THE C..C++ boundary |
690 canvas->drawImage((const SkImage*)cimage, 20, 20, NULL); | 693 canvas->drawImage((const SkImage*)cimage, 20, 20, NULL); |
691 | 694 |
692 sk_path_delete(cpath); | 695 sk_path_delete(cpath); |
693 sk_paint_delete(cpaint); | 696 sk_paint_delete(cpaint); |
694 sk_image_unref(cimage); | 697 sk_image_unref(cimage); |
695 sk_surface_unref(csurface); | 698 sk_surface_unref(csurface); |
696 } | 699 } |
OLD | NEW |