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

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

Issue 1778393002: add Make variations to return SkImage by sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: roll in fmalitas comments Created 4 years, 9 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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkImage.h" 10 #include "SkImage.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } 217 }
218 218
219 //////////////////////////////////////////////////////////////////////////////// /////////// 219 //////////////////////////////////////////////////////////////////////////////// ///////////
220 220
221 sk_image_t* sk_image_new_raster_copy(const sk_imageinfo_t* cinfo, const void* pi xels, 221 sk_image_t* sk_image_new_raster_copy(const sk_imageinfo_t* cinfo, const void* pi xels,
222 size_t rowBytes) { 222 size_t rowBytes) {
223 SkImageInfo info; 223 SkImageInfo info;
224 if (!from_c_info(*cinfo, &info)) { 224 if (!from_c_info(*cinfo, &info)) {
225 return NULL; 225 return NULL;
226 } 226 }
227 return (sk_image_t*)SkImage::NewRasterCopy(info, pixels, rowBytes); 227 return (sk_image_t*)SkImage::MakeRasterCopy(SkPixmap(info, pixels, rowBytes) ).release();
228 } 228 }
229 229
230 sk_image_t* sk_image_new_from_encoded(const sk_data_t* cdata, const sk_irect_t* subset) { 230 sk_image_t* sk_image_new_from_encoded(const sk_data_t* cdata, const sk_irect_t* subset) {
231 return ToImage(SkImage::NewFromEncoded(AsData(cdata), 231 return ToImage(SkImage::MakeFromEncoded(sk_ref_sp(AsData(cdata)),
232 reinterpret_cast<const SkIRect*>(subs et))); 232 reinterpret_cast<const SkIRect*>(subs et)).release());
233 } 233 }
234 234
235 sk_data_t* sk_image_encode(const sk_image_t* cimage) { 235 sk_data_t* sk_image_encode(const sk_image_t* cimage) {
236 return ToData(AsImage(cimage)->encode()); 236 return ToData(AsImage(cimage)->encode());
237 } 237 }
238 238
239 void sk_image_ref(const sk_image_t* cimage) { 239 void sk_image_ref(const sk_image_t* cimage) {
240 AsImage(cimage)->ref(); 240 AsImage(cimage)->ref();
241 } 241 }
242 242
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 698
699 size_t sk_data_get_size(const sk_data_t* cdata) { 699 size_t sk_data_get_size(const sk_data_t* cdata) {
700 return AsData(cdata)->size(); 700 return AsData(cdata)->size();
701 } 701 }
702 702
703 const void* sk_data_get_data(const sk_data_t* cdata) { 703 const void* sk_data_get_data(const sk_data_t* cdata) {
704 return AsData(cdata)->data(); 704 return AsData(cdata)->data();
705 } 705 }
706 706
707 //////////////////////////////////////////////////////////////////////////////// /////////// 707 //////////////////////////////////////////////////////////////////////////////// ///////////
OLDNEW
« no previous file with comments | « include/core/SkShader.h ('k') | src/core/SkPictureShader.h » ('j') | src/image/SkImage.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698