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

Side by Side Diff: src/c/sk_surface.cpp

Issue 1199473002: change old picture serialization to really handle images (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 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 /* 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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698