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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 sk_image_t* sk_image_new_raster_copy(const sk_imageinfo_t* cinfo, const void* pi
xels, | 201 sk_image_t* sk_image_new_raster_copy(const sk_imageinfo_t* cinfo, const void* pi
xels, |
202 size_t rowBytes) { | 202 size_t rowBytes) { |
203 SkImageInfo info; | 203 SkImageInfo info; |
204 if (!from_c_info(*cinfo, &info)) { | 204 if (!from_c_info(*cinfo, &info)) { |
205 return NULL; | 205 return NULL; |
206 } | 206 } |
207 return (sk_image_t*)SkImage::NewRasterCopy(info, pixels, rowBytes); | 207 return (sk_image_t*)SkImage::NewRasterCopy(info, pixels, rowBytes); |
208 } | 208 } |
209 | 209 |
210 sk_image_t* sk_image_new_from_data(const sk_data_t* cdata) { | 210 sk_image_t* sk_image_new_from_encoded(const sk_data_t* cdata, const sk_irect_t*
subset) { |
211 return ToImage(SkImage::NewFromData(AsData(cdata))); | 211 return ToImage(SkImage::NewFromEncoded(AsData(cdata), |
| 212 reinterpret_cast<const SkIRect*>(subs
et))); |
212 } | 213 } |
213 | 214 |
214 sk_data_t* sk_image_encode(const sk_image_t* cimage) { | 215 sk_data_t* sk_image_encode(const sk_image_t* cimage) { |
215 return ToData(AsImage(cimage)->encode()); | 216 return ToData(AsImage(cimage)->encode()); |
216 } | 217 } |
217 | 218 |
218 void sk_image_ref(const sk_image_t* cimage) { | 219 void sk_image_ref(const sk_image_t* cimage) { |
219 AsImage(cimage)->ref(); | 220 AsImage(cimage)->ref(); |
220 } | 221 } |
221 | 222 |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 sk_image_t* cimage = sk_surface_new_image_snapshot(csurface); | 624 sk_image_t* cimage = sk_surface_new_image_snapshot(csurface); |
624 | 625 |
625 // HERE WE CROSS THE C..C++ boundary | 626 // HERE WE CROSS THE C..C++ boundary |
626 canvas->drawImage((const SkImage*)cimage, 20, 20, NULL); | 627 canvas->drawImage((const SkImage*)cimage, 20, 20, NULL); |
627 | 628 |
628 sk_path_delete(cpath); | 629 sk_path_delete(cpath); |
629 sk_paint_delete(cpaint); | 630 sk_paint_delete(cpaint); |
630 sk_image_unref(cimage); | 631 sk_image_unref(cimage); |
631 sk_surface_unref(csurface); | 632 sk_surface_unref(csurface); |
632 } | 633 } |
OLD | NEW |